<?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
    {
        // Adaugă funcționalități DynDNS la tabelul plans
        Schema::table('plans', function (Blueprint $table) {
            $table->boolean('dyndns_enabled')->default(false)->after('api_features');
            $table->integer('dyndns_max_clients')->default(0)->after('dyndns_enabled')->comment('Numărul maxim de clienți DynDNS permis (0 = nelimitat)');
        });

        // Adaugă funcționalități DynDNS la tabelul reseller_plans
        Schema::table('reseller_plans', function (Blueprint $table) {
            $table->boolean('dyndns_enabled')->default(false)->after('api_features');
            $table->integer('dyndns_max_clients')->default(0)->after('dyndns_enabled')->comment('Numărul maxim de clienți DynDNS permis (0 = nelimitat)');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('plans', function (Blueprint $table) {
            $table->dropColumn([
                'dyndns_enabled',
                'dyndns_max_clients'
            ]);
        });

        Schema::table('reseller_plans', function (Blueprint $table) {
            $table->dropColumn([
                'dyndns_enabled',
                'dyndns_max_clients'
            ]);
        });
    }
};
