<?php

namespace Database\Seeders;

use App\Models\SalaryRule;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class DatabaseSeeder extends Seeder
{
    use WithoutModelEvents;

    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        User::query()->updateOrCreate(
            ['email' => 'admin@company.test'],
            [
                'name' => 'Admin User',
                'role' => 'admin',
                'is_active' => true,
                'password' => Hash::make('password'),
            ]
        );

        User::query()->updateOrCreate(
            ['email' => 'staff@company.test'],
            [
                'name' => 'Staff User',
                'role' => 'staff',
                'is_active' => true,
                'password' => Hash::make('password'),
            ]
        );

        SalaryRule::query()->updateOrCreate(
            ['is_active' => true],
            [
                'point_value' => 1000,
                'monthly_target_point' => 15,
                'effective_from' => now()->toDateString(),
            ]
        );
    }
}
