<?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 $table) {
            $table->id();
            $table->string('code', 50)->unique();
            $table->string('name', 100);
            $table->string('billing_cycle', 30)->default('monthly');
            $table->decimal('price', 10, 2)->default(0);
            $table->decimal('list_price', 10, 2)->default(0);
            $table->string('status', 30)->default('active');
            $table->unsignedInteger('sort')->default(0);
            $table->text('description')->nullable();
            $table->json('settings')->nullable();
            $table->timestamp('published_at')->nullable();
            $table->timestamps();
        });
    }

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