<?php

namespace Database\Factories\Claim;

use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
 */
class TerminalIllnessFactory extends Factory {
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array {
        $hasMedicalRef = $this->faker->optional()->boolean();
        $isTerminal = $this->faker->optional(0.2)->boolean();

        return [
            'terminal_illness_details' => $isTerminal
                ? $this->faker->paragraph()
                : null,
            'applied_advance_payment' => $this->faker->optional()->boolean(),
            'permission_confirm_health' => $this->faker->optional()->boolean(),
            'provide_ds1500' => $isTerminal
                ? $this->faker->boolean()
                : null,
            'agree_contact_healthcare' => $this->faker->optional()->boolean(),
            'has_medical_ref' => $hasMedicalRef,
            'medical_reference_number' => $hasMedicalRef
                ? strtoupper(Str::random(10))
                : null,
            'healthcare_type' => $this->faker->optional(0.7)->randomElement([
                'GP',
                'Consultant',
                'Nurse',
                'Hospital',
                'Specialist',
            ]),
            'healthcare_name' => $this->faker->optional(0.7)->name(),
            'healthcare_place_of_work' => $this->faker->optional(0.6)->company(),
            'healthcare_email' => $this->faker->optional(0.6)->safeEmail(),
            'healthcare_phone' => $this->faker->optional(0.6)->phoneNumber(),
            'healthcare_address_1' => $this->faker->optional(0.6)->streetAddress(),
            'healthcare_address_2' => $this->faker->optional(0.3)->city(),
            'healthcare_postcode' => $this->faker->optional(0.6)->postcode(),
        ];
    }
}
