<?php

namespace App\Http\Requests;

use Illuminate\Validation\Rule;

/**
 * @OA\Parameter(
 *     parameter="ApiTokenQuery",
 *     name="api_token",
 *     in="query",
 *     required=true,
 *     description="Room session 的 API token",
 *     @OA\Schema(
 *         type="string",
 *         example="da9cdb88a60a377bba9fc53f09dd07838eb6f4f355d63f4927c711e7aaae3104"
 *     )
 * )
 * @OA\Schema(
 *     schema="RoomSongRequest",
 *     type="object",
 *     required={"api_token"},
 *     @OA\Property(
 *         property="api_token",
 *         type="string",
 *         description="Room session 的 API token",
 *         example="da9cdb88a60a377bba9fc53f09dd07838eb6f4f355d63f4927c711e7aaae3104"
 *     )
 * )
 */
class RoomSongRequest extends ApiRequest
{
    public function rules(): array
    {
        return [
            'api_token' => [
                'required',
                Rule::exists('room_sessions', 'api_token')
                    ->where(fn ($q) => $q->whereIn('status', ['active', 'maintain']))
            ]
        ];
    }
}