<?php

declare(strict_types=1);

namespace Database\Factories;

use App\Enums\GroupType;
use App\Models\Branch;
use App\Models\Group;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<Group>
 */
class GroupFactory extends Factory
{
    public function definition(): array
    {
        return [
            'branch_id' => Branch::factory(),
            'leader_member_id' => null,
            'name' => fake()->words(2, true).' Group',
            'type' => fake()->randomElement(GroupType::cases()),
            'description' => fake()->optional()->sentence(),
            'is_active' => true,
        ];
    }

    public function organizationWide(): static
    {
        return $this->state(fn (array $attributes) => [
            'branch_id' => null,
        ]);
    }
}
