<?php

namespace Database\Factories;

use App\Enums\FormType;
use App\Models\FormQuestionGroup;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<FormQuestionGroup>
 */
class FormQuestionGroupFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $icons = [
            'heroicon-o-user',
            'heroicon-o-home',
            'heroicon-o-user-group',
            'heroicon-o-heart',
            'heroicon-o-sparkles',
            'heroicon-o-building-office',
            'heroicon-o-phone',
            'heroicon-o-star',
            'heroicon-o-clock',
            'heroicon-o-currency-dollar',
            'heroicon-o-hand-raised',
        ];

        return [
            'form_type' => fake()->randomElement(FormType::cases()),
            'name' => fake()->words(2, true),
            'icon' => fake()->boolean(70) ? fake()->randomElement($icons) : null,
            'description' => fake()->boolean(50) ? fake()->sentence() : null,
            'sort_order' => fake()->numberBetween(0, 100),
            'is_active' => fake()->boolean(90),
        ];
    }

    /**
     * Indicate that the group is for adoption forms.
     */
    public function adoption(): static
    {
        return $this->state(fn (array $attributes) => [
            'form_type' => FormType::Adoption,
        ]);
    }

    /**
     * Indicate that the group is for fostering forms.
     */
    public function fostering(): static
    {
        return $this->state(fn (array $attributes) => [
            'form_type' => FormType::Fostering,
        ]);
    }

    /**
     * Indicate that the group is for assistance forms.
     */
    public function assistance(): static
    {
        return $this->state(fn (array $attributes) => [
            'form_type' => FormType::Assistance,
        ]);
    }

    /**
     * Indicate that the group is active.
     */
    public function active(): static
    {
        return $this->state(fn (array $attributes) => [
            'is_active' => true,
        ]);
    }

    /**
     * Indicate that the group is inactive.
     */
    public function inactive(): static
    {
        return $this->state(fn (array $attributes) => [
            'is_active' => false,
        ]);
    }
}
