<?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('user_subscriptions', function (Blueprint $table) {
            // payment_status: null = legacy row, 'pending' = awaiting admin approval,
            // 'approved' = confirmed, 'rejected' = declined
            $table->string('payment_status')->nullable()->after('is_active');
            $table->string('tx_hash')->nullable()->after('payment_status');
            $table->text('admin_notes')->nullable()->after('tx_hash');
        });
    }

    public function down(): void
    {
        Schema::table('user_subscriptions', function (Blueprint $table) {
            $table->dropColumn(['payment_status', 'tx_hash', 'admin_notes']);
        });
    }
};
