<?php

namespace Database\Seeders;

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

class DatabaseSeeder extends Seeder
{
    use WithoutModelEvents;

    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        // Roles
        $this->call(RoleSeeder::class);

        // Admin User
        $admin = User::firstOrCreate([
            'email' => 'admin@medchamber.com',
        ], [
            'name' => 'Admin User',
            'password' => bcrypt('password'),
        ]);
        if (!$admin->hasRole('Admin')) {
            $admin->assignRole('Admin');
        }

        // Test User
        User::firstOrCreate([
            'email' => 'test@example.com',
        ], [
            'name' => 'Test User',
            'password' => bcrypt('password'),
        ]);

        // Default Chambers
        \App\Models\Chamber::firstOrCreate([
            'name' => 'Square Hospital',
        ], [
            'address' => '18/F Bir Uttam Qazi Nuruzzaman Sarak, West Panthapath, Dhaka 1205',
            'phone' => '+8801711223344',
            'new_patient_fee' => 1500,
            'returning_patient_fee' => 1000,
            'is_active' => true,
        ]);

        \App\Models\Chamber::firstOrCreate([
            'name' => 'Private Chamber',
        ], [
            'address' => 'House 12, Road 4, Dhanmondi R/A, Dhaka 1209',
            'phone' => '+8801711223355',
            'new_patient_fee' => 1200,
            'returning_patient_fee' => 800,
            'is_active' => true,
        ]);
    }
}
