<?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('activities', function (Blueprint $table) {
            $table->uuid('id')->primary();

            // RELATION
            $table->foreignUuid('user_id')->constrained()->cascadeOnDelete();

            // TYPE
            $table->string('type');
            // event_created, note_added, reminder_sent etc.

            // CONTENT
            $table->string('title'); // "Termin erstellt"
            $table->text('description')->nullable();

            // OPTIONAL CONTEXT
            $table->string('subject_type')->nullable();
            // z.B. reminder, contact, event

            $table->uuid('subject_id')->nullable();

            // EXTRA (für spätere Erweiterung)
            $table->json('meta')->nullable();

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

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