<?php

namespace Database\Factories;

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

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Show>
 */
class ShowFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var class-string<\Illuminate\Database\Eloquent\Model>
     */
    protected $model = Show::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'showId' => 'SHOW-'.strtoupper(fake()->unique()->bothify('??####')),
            'title' => fake()->sentence(3),
            'description' => fake()->paragraph(),
            'lineup' => [
                fake()->name(),
                fake()->name(),
                fake()->name(),
            ],
            'seitansai' => null,
            'graduation' => null,
            'start_time' => fake()->unixTime(),
            'type' => fake()->randomElement(['Regular', 'Special', 'Graduation', 'Seitansai']),
            'price' => fake()->randomFloat(2, 10000, 500000),
            'banner_link' => fake()->imageUrl(1200, 400),
            'is_promo' => fake()->boolean(30),
            'promo_price' => function (array $attributes) {
                return $attributes['is_promo'] ? fake()->randomFloat(2, 5000, $attributes['price']) : null;
            },
            'is_active' => fake()->boolean(70),
            'is_live' => fake()->boolean(20),
            'is_replay' => fake()->boolean(30),
            'streamer_live' => '50a27780-93e7-4e40-8474-60f6e0cca6da',
            'slug_live' => fake()->unique()->slug(),
            'url_live' => fake()->boolean(50) ? fake()->url() : null,
            'url_replay' => fake()->boolean(40) ? fake()->url() : null,
            'type_live' => fake()->randomElement(['idn', 'youtube', 'twitch']),
        ];
    }
}

