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

            $table->string('title')->nullable();
            $table->text('content');
            $table->string('color')->default('yellow');  // yellow|blue|green|pink|purple|gray
            $table->boolean('pinned')->default(false);

            $table->timestamps();

            $table->index(['user_id', 'pinned', 'created_at']);
        });
    }

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