<?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->unsignedBigInteger('ticket_id')->nullable();
            $table->string('name');
            $table->string('phone_number');
            $table->string('chair_type');
            $table->integer('number_chair');
            $table->integer('total');
            $table->boolean('is_used')->default(false); // Default value
            $table->timestamps();

            // Foreign key constraint
            $table->foreign('ticket_id')->references('id')->on('ticket')->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('payments', function (Blueprint $table) {
            $table->dropColumn('is_used');
        });
    }
};
