<?php

namespace Database\Factories;

use App\Models\Diagnosis;
use App\Models\JobCard;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Estimate>
 */
class EstimateFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'estimate_number' => 'MAIN/EST'.str_pad(fake()->unique()->numberBetween(1, 9999), 4, '0', STR_PAD_LEFT),
            'job_card_id' => JobCard::factory(),
            'diagnosis_id' => Diagnosis::factory(),
            'prepared_by_id' => User::factory(),
            'labor_cost' => fake()->randomFloat(2, 100, 1000),
            'parts_cost' => fake()->randomFloat(2, 50, 500),
            'miscellaneous_cost' => fake()->randomFloat(2, 0, 100),
            'subtotal' => fake()->randomFloat(2, 200, 1500),
            'tax_rate' => 8.25,
            'tax_amount' => fake()->randomFloat(2, 10, 100),
            'discount_amount' => fake()->randomFloat(2, 0, 50),
            'total_amount' => fake()->randomFloat(2, 210, 1600),
            'terms_and_conditions' => fake()->paragraph(),
            'validity_period_days' => fake()->numberBetween(7, 90),
            'notes' => fake()->optional()->paragraph(),
            'internal_notes' => fake()->optional()->paragraph(),
        ];
    }
}
