<?php

namespace Database\Factories;

use App\Models\Ville;
use App\Models\Pays;
use Illuminate\Database\Eloquent\Factories\Factory;

class VilleFactory extends Factory
{
    public function definition(): array
    {
        return [
            'pays_id' => Pays::factory(),
            'nom' => fake()->city(),
            'slug' => fake()->slug(),
            'actif' => fake()->boolean(80), // 80% chance of being active
            'ordre_affichage' => fake()->numberBetween(1, 100),
        ];
    }

    public function active(): static
    {
        return $this->state(fn (array $attributes) => [
            'actif' => true,
        ]);
    }

    public function inactive(): static
    {
        return $this->state(fn (array $attributes) => [
            'actif' => false,
        ]);
    }

    /**
     * État : ville active (actif = true)
     */
    public function actif(): static
    {
        return $this->state(fn (array $attributes) => [
            'actif' => true,
        ]);
    }
}
