<?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('network_statuses', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->text('description')->nullable();
            $table->enum('status', ['reported', 'investigating', 'in_progress', 'resolved', 'scheduled'])->default('reported');
            $table->enum('type', ['incident', 'maintenance', 'degraded_performance', 'partial_outage', 'major_outage'])->default('incident');
            $table->enum('impact', ['none', 'minor', 'major', 'critical'])->default('minor');
            $table->timestamp('started_at')->nullable();
            $table->timestamp('resolved_at')->nullable();
            $table->timestamp('scheduled_at')->nullable();
            $table->timestamp('scheduled_end_at')->nullable();
            $table->json('affected_services')->nullable();
            $table->integer('sort_order')->default(0);
            $table->timestamps();
        });
    }

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