<?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('voucher_agents', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->nullable();
            $table->string('phone')->nullable();
            $table->decimal('opening_float', 10, 2)->default(0.00);
            $table->decimal('current_float', 10, 2)->default(0.00);
            $table->integer('assigned_vouchers_count')->default(0);
            $table->integer('sold_vouchers_count')->default(0);
            $table->decimal('commission_rate', 5, 2)->default(10.00); // 10%
            $table->string('status')->default('Active');
            $table->timestamps();
        });
    }

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