<?php

namespace Database\Factories;

use App\Enums\GameStatus;
use App\Enums\GameType;
use App\Models\Game;
use App\Support\PublicId;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends Factory<Game>
 */
class GameFactory extends Factory
{
    protected $model = Game::class;

    public function definition(): array
    {
        $name = fake()->unique()->words(2, true);

        return [
            'public_id' => PublicId::generate(),
            'name' => ucfirst($name),
            'slug' => Str::slug($name),
            'short_name' => Str::upper(Str::substr($name, 0, 4)),
            'game_type' => GameType::Both,
            'status' => GameStatus::Active,
            'sort_order' => 0,
            'supports_ranks' => true,
            'supports_roles' => true,
            'supports_characters' => false,
            'supports_regions' => true,
            'supports_servers' => false,
        ];
    }
}
