<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('rentals', function (Blueprint $table) {
            $table->enum('insurance_status', ['held', 'partially_refunded', 'refunded'])->default('held')->after('insurance_amount');
            $table->decimal('insurance_refunded_amount', 10, 2)->nullable()->after('insurance_status');
            $table->text('insurance_notes')->nullable()->after('insurance_refunded_amount');
            
            $table->enum('deposit_type', ['cash', 'transfer', 'check'])->nullable()->after('insurance_notes');
            $table->decimal('late_fee_per_day', 10, 2)->default(0)->after('deposit_type');
            $table->enum('contract_source', ['direct', 'booking', 'repeat_customer'])->default('direct')->after('late_fee_per_day');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('rentals', function (Blueprint $table) {
            $table->dropColumn([
                'insurance_status',
                'insurance_refunded_amount',
                'insurance_notes',
                'deposit_type',
                'late_fee_per_day',
                'contract_source',
            ]);
        });
    }
};
