<?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::create('tenants', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->enum('plan', ['free', 'pro', 'agency'])->default('free');
            $table->enum('status', ['active', 'suspended', 'expired'])->default('active');
            $table->timestamp('subscription_start')->nullable();
            $table->timestamp('subscription_end')->nullable();
            $table->string('default_country', 2)->default('PK');
            $table->boolean('notifications_enabled')->default(true);
            $table->string('timezone', 50)->default('UTC');
            $table->json('settings')->nullable();
            $table->timestamps();

            $table->index('plan');
            $table->index('status');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('tenants');
    }
};
