<?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('popups', function (Blueprint $table) {
            $table->id();

            $table->string('title');
            $table->string('description')->nullable();

            $table->text('popup_link')->nullable();
            $table->foreignId('page_id')->nullable()->constrained('pages');

            $table->text('image')->nullable();
            $table->text('image_mobile')->nullable();

            $table->tinyInteger('display_type')->default(1)->comment('1 img, 2 text');

            $table->tinyInteger('popup_display_scope')->default(1)->comment('1 all, 2 only index');
            $table->tinyInteger('popup_display_freq')->default(1)->comment('1 once, 2 daily, 3 everytime');

            $table->boolean('status')->default(1);
            $table->integer('ordernum')->default(0);

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

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