<?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('pages', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->string('uuid')->unique();
            $table->string('title');
            $table->string('slug');
            $table->json('content');
            $table->boolean('is_published')->default(false);
            $table->boolean('main')->default(false);
            $table->boolean('linked')->default(false);
            $table->integer('linkorder')->default(0);
            $table->enum('visibility', ['public', 'private'])->default('public');
            $table->timestamps();
        });
    }

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