<?php

namespace Database\Seeders;

use App\Models\User;
use App\Models\Courier;
use App\Models\OrderStatus;
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
    {
        // Seed Admin User
        User::updateOrCreate(
            ['email' => 'fariss@okelaundry.com'],
            [
                'name' => 'Fariss',
                'password' => Hash::make('password'),
                'role' => 'admin',
            ]
        );

        // Seed Order Statuses
        $statuses = ['jemput', 'proses', 'antar', 'selesai', 'ditolak'];
        foreach ($statuses as $status) {
            OrderStatus::updateOrCreate(
                ['status_name' => $status]
            );
        }

        // Seed Couriers
        Courier::updateOrCreate(
            ['name' => 'Anto'],
            ['phone' => '0899999999']
        );
        Courier::updateOrCreate(
            ['name' => 'Bambang'],
            ['phone' => '0888888888']
        );
    }
}
