<?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('reserve_box_transactions', function (Blueprint $table) {
            $table->id();
            $table->string('transaction_type');
            $table->string('from_box')->nullable();
            $table->string('to_box')->nullable();
            $table->unsignedBigInteger('cash_amount')->nullable();
            $table->unsignedBigInteger('online_amount')->nullable();
            $table->unsignedBigInteger('amount');
            $table->unsignedBigInteger('created_by')->nullable();
            $table->date('transaction_date');
            $table->string('notes')->nullable();
            $table->timestamps();

            $table->index(['transaction_type', 'transaction_date']);
            $table->index(['from_box', 'to_box']);
        });
    }

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