<?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('transfer_requests', function (Blueprint $table) {
            $table->id();
            $table->foreignId('from_account_id')->constrained('accounts')->cascadeOnDelete();
            $table->string('type');
            $table->foreignId('to_account_id')->nullable()->constrained('accounts')->nullOnDelete();
            $table->json('recipient_details')->nullable();
            $table->decimal('amount', 15, 2);
            $table->string('currency');
            $table->decimal('fee', 10, 2)->default(0);
            $table->string('description')->nullable();
            $table->string('status')->default('pending');
            $table->timestamps();
        });
    }

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