<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     * Add sick, permission, leave to the type enum column
     */
    public function up(): void
    {
        DB::statement("ALTER TABLE attendances MODIFY COLUMN type ENUM('office', 'wfh', 'business_trip', 'sick', 'permission', 'leave') NOT NULL DEFAULT 'office'");
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        // Note: This will fail if there are records with sick, permission, or leave types
        DB::statement("ALTER TABLE attendances MODIFY COLUMN type ENUM('office', 'wfh', 'business_trip') NOT NULL DEFAULT 'office'");
    }
};
