<?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('payments', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->unsignedBigInteger('id_rek');
            $table->foreign('id_rek')->references('id')->on('rekenings')->onDelete('cascade');
            $table->string('invoice_id');
            $table->foreign('invoice_id')->references('invoice_id')->on('bookings')->onDelete('cascade');
            $table->string('nama_bank');
            $table->string('norek');
            $table->string('atas_nama');
            $table->string('bukti');
            $table->enum('status', ['progress', 'success', 'rejected', 'review'])->default("review");
            $table->timestamp('verified_at')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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