<?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::table('orders', function (Blueprint $table) {
            $table->string('payment_provider', 50)->default('razorpay')->after('payment_status');
            $table->string('payment_method', 50)->nullable()->after('payment_provider');
            $table->string('invoice_number')->nullable()->unique()->after('tracking_url');
            $table->decimal('gst_amount', 12, 2)->default(0)->after('delivery_amount');
            $table->timestamp('approved_at')->nullable()->after('printed_at');
            $table->timestamp('dispatched_at')->nullable()->after('shipped_at');
        });
    }

    public function down(): void
    {
        Schema::table('orders', function (Blueprint $table) {
            $table->dropColumn([
                'payment_provider',
                'payment_method',
                'invoice_number',
                'gst_amount',
                'approved_at',
                'dispatched_at',
            ]);
        });
    }
};
