<?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('settlement_legs',function(Blueprint $t){$t->id();$t->foreignId('settlement_batch_id')->constrained('settlement_batches')->cascadeOnDelete();$t->foreignId('transfer_id')->constrained('transfers');$t->foreignId('merchant_id')->constrained('merchants');$t->enum('leg',['send','receive']);$t->unsignedBigInteger('amount_minor');$t->char('currency',3);$t->timestamp('created_at')->useCurrent();$t->unique(['transfer_id','merchant_id','leg']);$t->index(['settlement_batch_id','transfer_id']);});}
 public function down():void{Schema::dropIfExists('settlement_legs');}
};
