<?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('deposits', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->string('method');
            $table->unsignedBigInteger('channel_id')->nullable();
            $table->decimal('amount', 16, 2);
            $table->decimal('bonus_amount', 16, 2)->default(0);
            $table->string('wallet_number');
            $table->string('provider');
            $table->string('trx_id')->nullable();
            $table->string('reference')->unique();
            $table->string('status')->default('pending'); // pending, submitted, approved, rejected
            $table->string('promotion_title')->nullable();
            $table->timestamp('submitted_at')->nullable();
            $table->timestamp('approved_at')->nullable();
            $table->timestamp('rejected_at')->nullable();
            $table->text('admin_note')->nullable();
            $table->timestamps();
        });
    }

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