[{"id":2926,"intent_key":"ranking_top20_programas_dia","label":"Top 20 programas del día","description":"","question_examples":null,"sql_query":"SELECT programa, SUM(plays) AS total_plays FROM vw_c13_videos_metricas_diarias WHERE fecha_metrica = CURDATE() GROUP BY programa ORDER BY total_plays DESC LIMIT 20","response_template":"Top 20 programas más vistos hoy:","is_active":1,"sort_order":0,"created_at":"2026-04-17 12:42:51","updated_at":"2026-04-17 15:16:25"},{"id":2927,"intent_key":"tp","label":"TP","description":"","question_examples":null,"sql_query":"SELECT programa, SUM(plays) AS total_plays FROM vw_c13_videos_metricas_diarias WHERE fecha_metrica = CURDATE() GROUP BY programa ORDER BY total_plays DESC LIMIT {{n}}","response_template":"*Top {{n}} programas del dia*\\n{{rows}}","is_active":1,"sort_order":100,"created_at":"2026-04-17 15:54:42","updated_at":"2026-04-28 00:14:18"},{"id":2928,"intent_key":"tc","label":"TC","description":"","question_examples":null,"sql_query":"SELECT titulo_video, SUM(plays) AS total_plays FROM vw_c13_videos_metricas_diarias WHERE fecha_metrica = CURDATE() GROUP BY titulo_video ORDER BY total_plays DESC LIMIT {{n}}","response_template":"*Top {{n}} capitulos del dia*\\n{{rows}}","is_active":1,"sort_order":101,"created_at":"2026-04-17 16:48:14","updated_at":"2026-04-28 00:14:18"},{"id":2929,"intent_key":"sus","label":"SUS","description":"","question_examples":null,"sql_query":"","response_template":"*Suscripciones*","is_active":1,"sort_order":102,"created_at":"2026-04-17 17:01:09","updated_at":"2026-04-28 00:14:18"},{"id":2930,"intent_key":"tpa","label":"TP Ayer","description":"","question_examples":null,"sql_query":"SELECT programa, SUM(plays) AS total_plays FROM vw_c13_videos_metricas_diarias WHERE fecha_metrica = DATE_SUB(CURDATE(), INTERVAL 1 DAY) GROUP BY programa ORDER BY total_plays DESC LIMIT {{n}}","response_template":"*Top {{n}} programas de ayer*\n{{rows}}","is_active":1,"sort_order":103,"created_at":"2026-04-17 17:09:23","updated_at":"2026-04-18 10:41:50"},{"id":2946,"intent_key":"sus_resumen","label":"SUS RESUMEN","description":"","question_examples":null,"sql_query":"WITH latest_total AS (\r\n    SELECT COALESCE(SUM(v.activos), 0) AS total_suscriptores\r\n    FROM vw_flow_suscripciones_diarias v\r\n    WHERE v.snapshot_date = (\r\n        SELECT MAX(snapshot_date)\r\n        FROM vw_flow_suscripciones_diarias\r\n    )\r\n),\r\nwindow_totals AS (\r\n    SELECT\r\n        SUM(CASE WHEN event_type = 'alta' AND event_datetime >= DATE_SUB(NOW(), INTERVAL 1 HOUR) THEN 1 ELSE 0 END) AS altas_1h,\r\n        SUM(CASE WHEN event_type = 'baja' AND event_datetime >= DATE_SUB(NOW(), INTERVAL 1 HOUR) THEN 1 ELSE 0 END) AS bajas_1h,\r\n        SUM(CASE WHEN event_type = 'alta' AND DATE(event_datetime) = CURDATE() THEN 1 ELSE 0 END) AS altas_hoy,\r\n        SUM(CASE WHEN event_type = 'baja' AND DATE(event_datetime) = CURDATE() THEN 1 ELSE 0 END) AS bajas_hoy,\r\n        SUM(CASE WHEN event_type = 'alta' AND event_datetime >= DATE_SUB(NOW(), INTERVAL 7 DAY) THEN 1 ELSE 0 END) AS altas_7d,\r\n        SUM(CASE WHEN event_type = 'baja' AND event_datetime >= DATE_SUB(NOW(), INTERVAL 7 DAY) THEN 1 ELSE 0 END) AS bajas_7d\r\n    FROM flow_suscripciones_eventos_detalle\r\n)\r\nSELECT indicador, valor\r\nFROM (\r\n    SELECT 1 AS ord, 'Total suscriptores' AS indicador, total_suscriptores AS valor\r\n    FROM latest_total\r\n    UNION ALL\r\n    SELECT 2 AS ord, 'Hoy' AS indicador,\r\n        CONCAT('Altas: ', COALESCE(altas_hoy, 0), '\/ Bajas: ', COALESCE(bajas_hoy, 0)) AS valor\r\n    FROM window_totals\r\n    UNION ALL\r\n    SELECT 3 AS ord, '1 hora' AS indicador,\r\n        CONCAT('Altas: ', COALESCE(altas_1h, 0), '\/ Bajas: ', COALESCE(bajas_1h, 0)) AS valor\r\n    FROM window_totals\r\n    UNION ALL\r\n    SELECT 4 AS ord, '7D' AS indicador,\r\n        CONCAT('Altas: ', COALESCE(altas_7d, 0), '\/ Bajas: ', COALESCE(bajas_7d, 0)) AS valor\r\n    FROM window_totals\r\n) resumen\r\nORDER BY ord","response_template":"RESUMEN DE SUSCRIPCIONES\r\n{{rows}}","is_active":1,"sort_order":103,"created_at":"2026-05-11 11:57:39","updated_at":"2026-05-11 15:55:55"}]