<?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::table('news', function (Blueprint $table) {
            $table->boolean('show_as_popup')->default(false)->after('is_active');
            $table->integer('popup_delay')->default(1000)->nullable()->after('show_as_popup');
            $table->enum('popup_frequency', ['once', 'daily', 'always'])->default('once')->after('popup_delay');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('news', function (Blueprint $table) {
            $table->dropColumn(['show_as_popup', 'popup_delay', 'popup_frequency']);
        });
    }
};
