<?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_preferences', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            
            // Notificação de vencimentos
            $table->boolean('notify_due_payments')->default(false);
            $table->time('notify_due_payments_time')->default('20:00:00');
            $table->string('notify_due_payments_email')->nullable(); // Se null, usa email do usuário
            
            // Outras preferências futuras podem ser adicionadas aqui
            $table->string('language')->default('pt-BR');
            $table->string('timezone')->default('Europe/Madrid');
            $table->string('currency')->default('EUR');
            
            $table->timestamps();
            
            $table->unique('user_id');
        });
    }

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