<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    use WithoutModelEvents;

    public function run(): void
    {
        $this->call([
            DiocesiSeeder::class,
            ComuniSeeder::class,
            RoleSeeder::class,
            RolePresetSeeder::class,
            DockerBaseDataSeeder::class,
        ]);

        $admin = User::create([
            'name' => 'Admin',
            'email' => 'admin@glastree.local',
            'password' => bcrypt('password'),
            'is_admin' => true,
            'status' => 'active',
            'permissions' => [
                'individui' => 2,
                'gruppi' => 2,
                'eventi' => 2,
                'documenti' => 2,
                'mailing' => 2,
                'viste' => 2,
            ],
        ]);

        $admin->role_preset_id = 1;
        $admin->save();
    }
}