<?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('subscription_packages', function (Blueprint $table) {
            // Drop old columns
            $table->dropColumn(['name', 'description', 'features']);
            
            // Add multilingual columns
            $table->string('name_en')->after('id');
            $table->string('name_fr')->after('name_en');
            $table->text('description_en')->nullable()->after('name_fr');
            $table->text('description_fr')->nullable()->after('description_en');
            $table->json('features_en')->nullable()->after('description_fr');
            $table->json('features_fr')->nullable()->after('features_en');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('subscription_packages', function (Blueprint $table) {
            // Restore old columns
            $table->string('name')->after('id');
            $table->text('description')->nullable()->after('name');
            $table->json('features')->nullable()->after('description');
            
            // Drop multilingual columns
            $table->dropColumn(['name_en', 'name_fr', 'description_en', 'description_fr', 'features_en', 'features_fr']);
        });
    }
};
