<?php

namespace Database\Factories;

use App\Models\MasterUnit;
use App\Models\Project;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends Factory<MasterUnit>
 */
class MasterUnitFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $unit_name       = fake()->name(2);
        $unit_code       = Str::of($unit_name)->lower()->slug();

        $status          = fake()->randomElement(
            [
                0,
                1
            ]
        );

        return [
            'unit_code'         => $unit_code,
            'unit_name'         => $unit_name,
            'project_id'        => Project::factory(),
            'status'            => $status,
            'description'       => fake()->text(200),
        ];
    }
}
