<?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('activity_logs', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->uuidMorphs('causer'); // causer_type, causer_id
            $table->uuidMorphs('subject'); // subject_type, subject_id
            $table->string('description');
            $table->foreignUuid('desa_id')->nullable()->constrained('desa')->nullOnDelete();
            $table->json('properties')->nullable();
            $table->timestamp('created_at')->nullable();
        });
    }

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