<?php

namespace Database\Seeders;

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

class CompanySeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {

        $owner = User::updateOrCreate(
            [
                'email' => 'owner@truetrucker.com',
            ],
            [
                'name' => 'John Doe',
                'password' => Hash::make('password'),
                'role' => 'owner',
            ]
        );

        $company = Company::updateOrCreate(
            ['name' => 'True Trucker Inc'],
            [
                'email' => 'owner@truetrucker.com',
                'mc_number' => 'MC123456',
                'dot_number' => 'DOT789012',
                'address' => '123 Fleet St, Dallas, TX 75201',
                'phone' => '(555) 123-4567',
                'plan' => 'starter',
                'num_trucks' => 2,
                'num_drivers' => 2,
                'created_by' => $owner->id,
                'owner_id' => $owner->id,
            ]
        );

        $owner->update(['company_id' => $company->id]);
    }
}
