<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_settings', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->foreignId('default_currency_id')->nullable()->constrained('currencies')->nullOnDelete();
            $table->enum('theme', ['light', 'dark', 'system'])->default('system');
            $table->string('locale', 10)->default('en');
            $table->string('timezone')->default('Asia/Jakarta');
            $table->enum('date_format', ['Y-m-d', 'd/m/Y', 'm/d/Y', 'd-m-Y', 'd M Y'])->default('d/m/Y');
            $table->enum('first_day_of_week', ['sunday', 'monday'])->default('monday');
            $table->boolean('email_notifications')->default(true);
            $table->boolean('budget_alerts')->default(true);
            $table->boolean('bill_reminders')->default(true);
            $table->boolean('weekly_summary')->default(false);
            $table->boolean('monthly_summary')->default(true);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_settings');
    }
};
