<?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::create('plans', function (Blueprint $table) {
            $table->uuid('id')->primary();

            $table->string('name'); // Free, Pro
            $table->integer('sort')->default(0);
            $table->string('plan_key'); // Free, Pro
            $table->integer('price'); // in cents (z.B. 1500 = 15€)

            $table->integer('yearly_discount_months')->default(0);
            $table->boolean('is_featured')->default(false); // "Beliebt"

            $table->integer('credit_limit')->default(0);
            $table->integer('device_limit')->default(1);

            $table->boolean('active')->default(true);
            $table->boolean('is_internal')->default(false);

            $table->json('ai_config')->nullable();

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('plans');
    }
};
