<?php

class Migration_20240915010230_my_call_flow
{
    public static function up(PDO $pdo)
    {
        // Your migration code here
        $sql = "
            CREATE TABLE IF NOT EXISTS my_call_flow (
                id INT AUTO_INCREMENT PRIMARY KEY,
                user_id INT NOT NULL,
                property_id INT NOT NULL,
                is_first_default_message boolean default 0,
                is_first_upload_audio boolean default 0,
                is_first_record_audio boolean default 0,
                is_first_textto_speech boolean default 0,
                first_audio_file VARCHAR(255) NULL,
                first_text TEXT NULL,
                is_no_response_default_message boolean default 0,
                is_no_response_upload_audio boolean default 0,
                is_no_response_record_audio boolean default 0,
                is_no_response_textto_speech boolean default 0,
                no_response_audio_file VARCHAR(255) NULL,
                no_response_text TEXT NULL,
                is_hang_up_message boolean default 0,
                press2_default_message boolean default 0,
                press2_upload_audio boolean default 0,
                press2_record_audio boolean default 0,
                press2_textto_speech boolean default 0,
                press2_audio_file VARCHAR(255) NULL,
                press2_text TEXT NULL,
                press2_auth_code_default_message boolean default 0,
                press2_auth_code_upload_audio boolean default 0,
                press2_auth_code_record_audio boolean default 0,
                press2_auth_code_textto_speech boolean default 0,
                press2_auth_code_audio_file VARCHAR(255) NULL,
                press2_auth_code_text TEXT NULL,
                press2_auth_code_ack_default_message boolean default 0,
                press2_auth_code_ack_upload_audio boolean default 0,
                press2_auth_code_ack_record_audio boolean default 0,
                press2_auth_code_ack_textto_speech boolean default 0,
                press2_auth_code_ack_audio_file VARCHAR(255) NULL,
                press2_auth_code_ack_text TEXT NULL,
                press2_auth_code_access_default_message boolean default 0,
                press2_auth_code_access_upload_audio boolean default 0,
                press2_auth_code_access_record_audio boolean default 0,
                press2_auth_code_access_textto_speech boolean default 0,
                press2_auth_code_access_audio_file VARCHAR(255) NULL,
                press2_auth_code_access_text TEXT NULL,
                press2_auth_code_denied_default_message boolean default 0,
                press2_auth_code_denied_upload_audio boolean default 0,
                press2_auth_code_denied_record_audio boolean default 0,
                press2_auth_code_denied_textto_speech boolean default 0,
                press2_auth_code_denied_audio_file VARCHAR(255) NULL,
                press2_auth_code_denied_text TEXT NULL,
                is_authorized_message boolean default 0,
                is_pre_notify_message boolean default 0,
                is_advertisement_default_message boolean default 0,
                is_advertisement_upload_audio boolean default 0,
                is_advertisement_record_audio boolean default 0,
                is_advertisement_textto_speech boolean default 0,
                advertisement_audio_file VARCHAR(255) NULL,
                advertisement_text TEXT NULL,
                is_connected_no_answer_default_message boolean default 0,
                is_connected_no_answer_upload_audio boolean default 0,
                is_connected_no_answer_record_audio boolean default 0,
                is_connected_no_answer_textto_speech boolean default 0,
                connected_no_answer_audio_file VARCHAR(255) NULL,
                connected_no_answer_text TEXT NULL,
                is_connected_hangeup_message boolean default 0,
                is_connected_hangeup_default_message boolean default 0,
                is_connected_hangeup_upload_audio boolean default 0,
                is_connected_hangeup_record_audio boolean default 0,
                is_connected_hangeup_textto_speech boolean default 0,
                connected_hangeup_audio_file VARCHAR(255) NULL,
                connected_hangeup_text TEXT NULL,
                is_beep_default_message boolean default 0,
                is_beep_upload_audio boolean default 0,
                is_beep_record_audio boolean default 0,
                is_beep_textto_speech boolean default 0,
                beep_audio_file VARCHAR(255) NULL,
                beep_text TEXT NULL,
                is_access_default_message boolean default 0,
                is_access_upload_audio boolean default 0,
                is_access_record_audio boolean default 0,
                is_access_textto_speech boolean default 0,
                access_audio_file VARCHAR(255) NULL,
                access_text TEXT NULL,
                is_grant_access_detail_message boolean default 0,
                is_hang_up_call_terminate boolean default 0,           
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
            );
        ";

        $pdo->exec($sql);
    }

    public static function down(PDO $pdo)
    {
        // Rollback code here
        // Rollback code here
        $sql = "
            DROP TABLE IF EXISTS my_call_flow;
        ";

        $pdo->exec($sql);
    }
}