<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

// ══════════════════════════════════════════════════════════════════
//  InPractice — Add theme column to users table
//
//  Fixes CRIT-01: theme preference was being saved by RegisterService
//  and the preference route but the column did not exist in the DB.
//
//  Values:
//    navy → Executive Navy (light theme)
//    dark → Premium Dark (dark theme)
//
//  Placed after language — both are user preference columns.
// ══════════════════════════════════════════════════════════════════

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->enum('theme', ['navy', 'dark'])
                  ->default('navy')
                  ->after('language');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('theme');
        });
    }
};
