<?php

declare(strict_types=1);

namespace Database\Factories;

use App\Models\Country;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<Country>
 */
class CountryFactory extends Factory
{
    protected $model = Country::class;

    public function definition(): array
    {
        $iso2 = fake()->unique()->lexify('??');
        $iso3 = fake()->unique()->lexify('???');

        return [
            'iso2' => strtoupper($iso2),
            'iso3' => strtoupper($iso3),
            'numeric_code' => str_pad((string) fake()->numberBetween(1, 999), 3, '0', STR_PAD_LEFT),
            'name_common' => fake()->unique()->country(),
            'name_official' => fake()->company().' Republic',
            'region' => fake()->randomElement(['Europe', 'Americas', 'Africa', 'Asia', 'Oceania']),
            'subregion' => fake()->randomElement(['Central Europe', 'North America', 'Western Africa', 'Eastern Asia']),
            'flag_svg_url' => 'https://example.test/flags/'.strtolower($iso2).'.svg',
            'flag_png_url' => 'https://example.test/flags/'.strtolower($iso2).'.png',
            'flag_emoji' => null,
            'active' => true,
            'sort_order' => 1000,
            'is_featured' => false,
        ];
    }
}
