<?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('emotions', function (Blueprint $table) {
            $table->id();
            $table->json('name');
            $table->string('icon', 50);
            $table->string('color', 7);
            $table->json('description')->nullable();
            $table->integer('sort_order')->default(0);
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });

        Schema::create('emotion_event_type', function (Blueprint $table) {
            $table->unsignedBigInteger('emotion_id');
            $table->unsignedBigInteger('event_type_id');
            $table->primary(['emotion_id', 'event_type_id']);
        });
    }

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

