<?php

namespace Database\Factories;

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

class LivestreamFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = Livestream::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'name' => $this->faker->name,
            'description' => $this->faker->paragraph,
            'video_id' => 'wf5uwSu21io',
            'start_date' => now()->addMinutes($this->faker->numberBetween(10, 5000))->roundMinute(10),
            'length' => $this->faker->numberBetween(10, 120),
            'chat_mode' => 'disabled',
            'unlisted' => false,
            'can_register' => false,
        ];
    }

    public function privateChat()
    {
        return $this->state(function (array $attributes) {
            return [
                'start_date' => now(),
                'length' => 60,
                'chat_mode' => 'private',
                'can_register' => true,
            ];
        });
    }
}
