<?php

namespace Database\Factories;

use App\Models\Feed;
use App\Models\PlatformChannel;
use App\Models\Route;
use Illuminate\Database\Eloquent\Factories\Factory;

class RouteFactory extends Factory
{
    protected $model = Route::class;

    public function definition(): array
    {
        return [
            'feed_id' => Feed::factory(),
            'platform_channel_id' => PlatformChannel::factory(),
            'is_active' => $this->faker->boolean(80), // 80% chance of being active
            'priority' => $this->faker->numberBetween(0, 100),
            'created_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
            'updated_at' => now(),
        ];
    }

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

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