<?php

declare(strict_types=1);

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('article_products', function (Blueprint $table): void {
            $table->id();
            $table->foreignId('article_id')->unique()->constrained('articles')->cascadeOnDelete();
            $table->boolean('enabled')->default(false);
            $table->decimal('price', 10, 2);
            $table->string('currency')->default('CNY');
            $table->string('trial_mode')->default('chars');
            $table->unsignedInteger('trial_value')->default(200);
            $table->timestamps();
        });
    }

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