<?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('plans', function (Blueprint $t) {
            $t->id();
            $t->string('slug')->unique();
            $t->string('name');
            $t->decimal('price_monthly', 10, 2)->default(0);
            $t->decimal('price_yearly', 10, 2)->default(0);
            $t->string('currency', 3)->default('MDL');
            $t->json('features')->nullable();   // ['kanban', 'reports', 'ai', ...]
            $t->json('limits')->nullable();     // ['max_users' => 5, 'max_vehicles' => 100, ...]
            $t->boolean('is_active')->default(true);
            $t->boolean('is_public')->default(true);
            $t->timestamps();
        });
    }

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