<?php

namespace Database\Seeders;

use App\Models\DriverPayout;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        User::firstOrCreate(
            ['email' => 'monitoring@example.com'],
            [
                'first_name' => 'Monitoring',
                'surname' => 'User',
                'name' => 'Monitoring User',
                'username' => 'monitoring',
                'user_no' => 'NG-MON-DEMO-0001',
                'phone' => '+2340000000000',
                'role' => 'monitoring',
                'password' => Hash::make('password'),
            ]
        );

        $accountUser = User::firstOrCreate(
            ['email' => 'account@example.com'],
            [
                'first_name' => 'Account',
                'surname' => 'User',
                'name' => 'Account User',
                'username' => 'account',
                'user_no' => 'NG-ACC-DEMO-0001',
                'phone' => '+2340000000001',
                'role' => 'account',
                'password' => Hash::make('password'),
            ]
        );

        DriverPayout::firstOrCreate(
            ['driver_account_no' => '0123456789'],
            [
                'driver_name' => 'Sample Driver One',
                'driver_bank' => 'Access Bank',
                'settlement_amount' => 50000,
                'payout_date' => now()->toDateString(),
                'deficit' => 0,
                'addition' => 2500,
                'total_amount' => 52500,
                'created_by' => $accountUser->id,
            ]
        );
    }
}
