<?php

namespace Database\Factories;

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

use Illuminate\Support\Facades\URL;
use App\Models\User;
use App\Models\Livestream;
use App\Models\Location;

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

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        $livestream = Livestream::factory()->create();
        $user = User::factory()->create();
        $url = URL::signedRoute('livestreams.user', ['id' => $livestream->id, 'user_id' => $user->id]);
        $unregister_url = URL::signedRoute('livestreams.unregister', ['id' => $livestream->id, 'user_id' => $user->id]);

        return [
            'user_id' => $user->id,
            'livestream_id' => $livestream->id,
            'location_id' => Location::factory(),
            'url' => $url,
            'unregister_url' => $unregister_url,
        ];
    }
}
