<?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('addressbook_meta', function (Blueprint $table) {
            $table->unsignedInteger('addressbook_id')->primary();
            $table->string('color', 7)->nullable();
            $table->boolean('is_default')->default(false);
            $table->json('settings')->nullable();
            $table->timestamps();

            $table->foreign('addressbook_id')
                  ->references('id')
                  ->on('addressbooks')
                  ->cascadeOnDelete();
        });
    }

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