<?php

namespace Database\Factories;

use App\Models\AzmayeshType;
use App\Models\Province;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Azmayesh>
 */
class AzmayeshFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'lat' => $this->faker->numerify,
            'lng' => $this->faker->numerify,
            'azmayesh_type_id' => AzmayeshType::factory(),
            'azmayesh_type_name' => function (array $attributes) {
                return AzmayeshType::query()->find($attributes['azmayesh_type_id'])->name;
            },
            'province_id' => Province::factory(),
            'province_name' => function (array $attributes) {
                return Province::query()->find($attributes['province_id'])->name_fa;
            },
            'request_date' => $this->faker->date,
            'report_date' => $this->faker->date,
            'request_number' => $this->faker->numerify,
            'employer' => $this->faker->name,
            'contractor' => $this->faker->name,
            'work_number' => $this->faker->numerify,
            'project_name' => $this->faker->name,
            'consultant' => $this->faker->name,
            'applicant' => $this->faker->name,
            'user_id' => User::factory(),
            'user_name' => function (array $attributes) {
                return User::query()->find($attributes['user_id'])->name;
            },
        ];
    }
}
