<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('bookings', function (Blueprint $table) {
            $table->id();
            $table->foreignId('customer_id')->constrained('users')->onDelete('cascade');
            $table->foreignId('tailor_id')->constrained('users')->onDelete('cascade');
            $table->date('appointment_date');
            $table->time('appointment_time');
            $table->enum('service_type', ['Perbaikan', 'Jahit Baru']);
            $table->enum('category', ['Atasan', 'Bawahan', 'Terusan']);
            $table->string('design_photo')->nullable();
            $table->text('notes')->nullable();
            $table->enum('status', [
                'reservasi',      // Status awal saat booking dibuat
                'diproses',      // Penjahit sudah menerima dan sedang mengerjakan
                'selesai',       // Jahitan sudah selesai
                'dibatalkan'     // Booking dibatalkan
            ])->default('reservasi');
            $table->decimal('total_price', 10, 2)->nullable();
            $table->enum('payment_status', ['unpaid', 'paid'])->default('unpaid');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('bookings');
    }
}; 