<?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('notices', function (Blueprint $table) {
            $table->id();
            $table->branchColumn();
            $table->string('title');
            $table->text('body');
            $table->enum('audience', ['all', 'parents', 'teachers', 'students'])->default('all')->index();
            $table->date('published_at')->nullable();
            $table->boolean('is_published')->default(true)->index();
            $table->auditColumns();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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