36 lines
1.3 KiB
PHP
36 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
/**
|
|
* @OA\Schema(
|
|
* schema="SendRoomSwitchCommandRequest",
|
|
* required={"branch_name", "room_name", "command"},
|
|
* @OA\Property(property="branch_name", type="string", example="測試"),
|
|
* @OA\Property(property="room_name", type="string", example="pc102"),
|
|
* @OA\Property(property="command", type="string", enum={"active", "closed", "fire", "error"}, example="active"),
|
|
* @OA\Property(property="started_at", type="string", nullable=true, example="2025-05-19 09:31:00"),
|
|
* @OA\Property(property="ended_at", type="string", nullable=true, example="2025-05-19 09:31:00")
|
|
* )
|
|
*/
|
|
class SendRoomSwitchCommandRequest extends ApiRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'branch_name' => ['required','string','exists:branches,name'],
|
|
'room_name' => ['required','string'],
|
|
'command' => ['required','in:active,closed,fire,error'],
|
|
'started_at'=> ['nullable','date_format:Y-m-d H:i:s'],
|
|
'ended_at' => ['nullable','date_format:Y-m-d H:i:s'],
|
|
];
|
|
}
|
|
}
|