<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('wallet_documents', function (Blueprint $table) {
            $table->id();
            $table->foreignId('registration_id')->constrained('event_registrations')->cascadeOnDelete();
            $table->foreignId('event_id')->constrained()->cascadeOnDelete();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->enum('category', ['flight_ticket', 'visa', 'travel_guide', 'dua', 'other'])->default('other');
            $table->string('name');
            $table->string('file_path');
            $table->string('file_type', 10)->nullable();
            $table->unsignedBigInteger('file_size')->nullable();
            $table->enum('uploaded_by', ['user', 'admin'])->default('user');
            $table->foreignId('uploaded_by_admin_id')->nullable()->constrained('admin_users')->nullOnDelete();
            $table->boolean('is_offline_available')->default(false);
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('wallet_documents');
    }
};
