<?php

declare(strict_types=1);

namespace Database\Factories\Wiki\Anime\Theme;

use App\Models\Wiki\Anime;
use App\Models\Wiki\Anime\AnimeTheme;
use App\Models\Wiki\Anime\Theme\AnimeThemeEntry;
use Illuminate\Database\Eloquent\Factories\Attributes\UseModel;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @method AnimeThemeEntry createOne($attributes = [])
 * @method AnimeThemeEntry makeOne($attributes = [])
 *
 * @extends Factory<AnimeThemeEntry>
 */
#[UseModel(AnimeThemeEntry::class)]
class AnimeThemeEntryFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            AnimeThemeEntry::ATTRIBUTE_THEME => AnimeTheme::factory(),
            AnimeThemeEntry::ATTRIBUTE_EPISODES => fake()->word(),
            AnimeThemeEntry::ATTRIBUTE_NOTES => fake()->word(),
            AnimeThemeEntry::ATTRIBUTE_NSFW => fake()->boolean(),
            AnimeThemeEntry::ATTRIBUTE_SPOILER => fake()->boolean(),
            AnimeThemeEntry::ATTRIBUTE_VERSION => fake()->randomDigitNotNull(),
        ];
    }

    /**
     * Add anime and theme to the entry.
     */
    public function forAnime(): static
    {
        return $this->for(AnimeTheme::factory()->for(Anime::factory()));
    }
}
