<?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('topbar_notifications', function (Blueprint $table) {
            $table->id();
            $table->string('content', 255);
            $table->string('button_label', 50);
            $table->string('button_url', 500);
            $table->date('start_date')->nullable();
            $table->date('end_date')->nullable();
            $table->boolean('is_active')->default(true);
            $table->integer('order')->default(0);
            $table->timestamps();

            $table->index(['is_active', 'end_date']);
            $table->index('order');
        });
    }

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