<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use App\Models\AdminUser;
use App\Models\Setting;

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        AdminUser::create([
            'name' => 'Administrador',
            'email' => 'admin@segunor.pt',
            'password' => Hash::make('Segunor2025!'),
            'role' => 'admin',
            'must_change_password' => true,
        ]);

        AdminUser::create([
            'name' => 'Recursos Humanos',
            'email' => 'rh@segunor.pt',
            'password' => Hash::make('Segunor2025!'),
            'role' => 'rh',
            'must_change_password' => true,
        ]);

        AdminUser::create([
            'name' => 'Contabilidade',
            'email' => 'contabilidade@segunor.pt',
            'password' => Hash::make('Segunor2025!'),
            'role' => 'contabilidade',
            'must_change_password' => true,
        ]);

        // Configurações padrão
        $defaults = [
            'campaign_enabled' => '1',
            'campaign_start' => '',
            'campaign_end' => '',
            'maintenance_mode' => '0',
        ];

        foreach ($defaults as $key => $value) {
            Setting::create(['key' => $key, 'value' => $value]);
        }
    }
}
