<?php

namespace Database\Seeders;

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

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        // --- Compte Admin ---
        User::create([
            'name' => 'Admin Techam',
            'email' => 'admin@labconnect.tn',
            'password' => Hash::make('ChangeMoi123!'),
            'role' => User::ROLE_ADMIN,
            'active' => true,
        ]);

        // --- Golden customer (premier partenaire de test) ---
        $goldenPartner = Partner::create([
            'name' => 'Clinique Pilote Nabeul',
            'type' => 'clinique',
            'address' => 'Nabeul, Tunisie',
            'contact_person' => 'A definir',
            'phone' => '',
            'email' => 'partenaire@labconnect.tn',
            'active' => true,
        ]);

        User::create([
            'name' => 'Contact Clinique Pilote',
            'email' => 'partenaire@labconnect.tn',
            'password' => Hash::make('ChangeMoi123!'),
            'role' => User::ROLE_PARTNER,
            'partner_id' => $goldenPartner->id,
            'active' => true,
        ]);

        // --- Coursier de test ---
        User::create([
            'name' => 'Coursier Test',
            'email' => 'coursier@labconnect.tn',
            'password' => Hash::make('ChangeMoi123!'),
            'role' => User::ROLE_COURIER,
            'active' => true,
        ]);
    }
}
