<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('sewas', function (Blueprint $table) {
            // Ubah kolom status menjadi ENUM dengan nilai yang valid
            DB::statement("ALTER TABLE sewas MODIFY status ENUM('draft', 'pending', 'confirmed', 'ongoing', 'completed', 'dibatalkan', 'ditolak', 'disetujui') NOT NULL DEFAULT 'draft'");
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('sewas', function (Blueprint $table) {
            $table->string('status')->default('pending')->change();
        });
    }
}; 