using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace VigilCareClinicalAPI.Migrations
{
    /// <inheritdoc />
    public partial class AddSofaObservationAlertTypes : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.Sql("""
                ALTER TABLE clinical_alerts DROP CONSTRAINT chk_clinical_alerts_alert_type;
                ALTER TABLE clinical_alerts ADD CONSTRAINT chk_clinical_alerts_alert_type
                    CHECK (alert_type IN (
                        'SEPSIS_WARNING',
                        'CRITICAL_HEART_RATE', 'CRITICAL_TEMP_C', 'CRITICAL_POTASSIUM_MEQ_L',
                        'CRITICAL_SPO2', 'CRITICAL_RESP_RATE', 'CRITICAL_WBC_K_UL',
                        'CRITICAL_SYSTOLIC_BP', 'CRITICAL_DIASTOLIC_BP', 'CRITICAL_LACTATE_MMOL_L',
                        'CRITICAL_AVPU', 'CRITICAL_GLUCOSE_MG_DL',
                        'CRITICAL_PAO2_MMHG', 'CRITICAL_PLATELET_K_UL',
                        'CRITICAL_BILIRUBIN_MG_DL', 'CRITICAL_CREATININE_MG_DL',
                        'WARNING_HEART_RATE', 'WARNING_TEMP_C', 'WARNING_POTASSIUM_MEQ_L',
                        'WARNING_SPO2', 'WARNING_RESP_RATE', 'WARNING_WBC_K_UL',
                        'WARNING_SYSTOLIC_BP', 'WARNING_DIASTOLIC_BP', 'WARNING_LACTATE_MMOL_L',
                        'WARNING_GLUCOSE_MG_DL',
                        'WARNING_PAO2_MMHG', 'WARNING_PLATELET_K_UL',
                        'WARNING_BILIRUBIN_MG_DL', 'WARNING_CREATININE_MG_DL',
                        'NEWS2_WARNING', 'NEWS2_EMERGENCY',
                        'RAPID_DETERIORATION', 'QSOFA_WARNING',
                        'GCS_CRITICAL', 'GCS_WARNING'
                    ));
                """);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {

        }
    }
}
