<?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('notification_failures', function (Blueprint $table) {
            $table->id();
            $table->string('notification_type');
            $table->string('notifiable_type');
            $table->unsignedBigInteger('notifiable_id');
            $table->string('channel')->default('mail'); // mail, slack, sms, etc.
            $table->text('exception')->nullable();
            $table->json('data')->nullable();
            $table->boolean('is_fixed')->default(false);
            $table->integer('retry_count')->default(0);
            $table->timestamps();
        });

    }

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