<?php

namespace Database\Seeders;

use App\Models\Company;
use App\Models\Truck;
use Illuminate\Database\Seeder;

class TruckSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $company = Company::first();

        if (! $company) {
            return;
        }

        Truck::updateOrCreate(
            ['number' => 'TRK001'],
            [
                'company_id' => $company->id,
                'name' => 'Truck 001',
                'equipment_number' => 'EQ123',
                'fuel_cost_per_mile' => 0.60,
            ]
        );

        Truck::updateOrCreate(
            ['number' => 'TRK002'],
            [
                'company_id' => $company->id,
                'name' => 'Truck 002',
                'equipment_number' => 'EQ124',
                'fuel_cost_per_mile' => 0.70,
            ]
        );
    }
}
