CREATE OR REPLACE TASK check_af_tables_parity_task
    WAREHOUSE = SUNO_PROD_ENGINEER_X_SMALL
    SCHEDULE = 'USING CRON 0 12 * * * UTC'
AS
    DECLARE
        has_differences boolean;
        alert_message STRING;
    BEGIN
        CALL check_af_tables_parity_proc() into :has_differences;
        IF (:has_differences) THEN
            alert_message := '🚨 ALERT: APPSFLYER.SNOWFLAKE and SUNO_PROD.PROD.AF_ table schemas are [not in parity](https://github.com/suno-ai/snowflake/blob/main/code/suno_prod/README.md#appsflyer-tables-troubleshooting)';
            select post_to_slack('#data-alerts', :alert_message);
        END IF;
    END;
