<?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('reservasiis', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
            $table->string('nama');
            $table->date('tanggal');
            $table->time('waktu');
            $table->foreignId('promo_id')->nullable()->constrained('promos');
            $table->decimal('total',10 , 2);
            $table->enum('tipe_pembayaran',['full','DP']);
            $table->string('metode_pembayaran');
            $table->string('bukti_pembayaran')->nullable();
            $table->enum('status_pembayaran', ['pending', 'approved', 'rejected'])->default('pending');
            $table->decimal('diskon', 10, 2)->default(0);
            $table->decimal('total_setelah_diskon', 10, 2)->default(0);
            $table->timestamps();
        });
    }

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