<?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('notifications', function (Blueprint $table) {

            $table->id();

            $table->string('title');

            $table->text('description');

            $table->string('origin');

            $table->unsignedBigInteger('origin_id');

            $table->string('type');

            $table->boolean('read')->default(false);

            $table->dateTime('read_at')->nullable();

           $table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();

            $table->softDeletes();

            $table->timestamps();
        });
    }

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