<?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('booking_fotos', function (Blueprint $table) {
            $table->id('id_booking');
            $table->string('no_invoice')->unique(); // Contoh: INV-FOTO-001

            // Foreign Keys
            $table->foreignId('id_pelanggan')->constrained('pelanggans', 'id_pelanggan')->onDelete('cascade');
            $table->foreignId('id_paket')->constrained('paket_fotos', 'id_paket')->onDelete('cascade');

            $table->date('tgl_booking');
            $table->time('jam_mulai');
            $table->time('jam_selesai');
            $table->decimal('total_bayar', 12, 2);
            $table->string('bukti_bayar')->nullable();

            // Enum Status Final
            $table->enum('status_booking', ['menunggu_verifikasi', 'diterima', 'ditolak', 'selesai', 'dibatalkan'])->default('menunggu_verifikasi');

            $table->timestamps();
        });
    }

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