<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

/**
 * @OA\Schema(
 *     schema="ReceiveSwitchRequest",
 *     required={"id","branch_id", "floor", "type", "name", "is_online", "status"},
 *     @OA\Property(property="id", type="integer", example="1"),
 *     @OA\Property(property="branch_id", type="integer", example="1"),
 *     @OA\Property(property="floor", type="integer", example=2),
 *     @OA\Property(property="type", type="string", enum={"unset", "pc", "svr"}, example="pc"),
 *     @OA\Property(property="name", type="string", example="102"),
 *     @OA\Property(property="internal_ip", type="string", nullable=true, example="192.168.1.100"),
 *     @OA\Property(property="port", type="integer", nullable=true, example=3389),
 *     @OA\Property(property="is_online", type="integer", enum={0, 1}, example=1),
 *     @OA\Property(property="status", type="string", enum={"active", "closed", "fire", "error"}, example="active"),
 *     @OA\Property(property="started_at", type="string", format="date-time", nullable=true, example="2025-05-19 09:31:00"),
 *     @OA\Property(property="ended_at", type="string", format="date-time", nullable=true, example="2025-05-19 12:00:00")
 * )
 */
class ReceiveSwitchRequest 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 [
            'id'            => ['required','integer','exists:rooms,id'],
            'branch_id'     => ['required','integer','exists:branches,id'],
            'floor'         => ['required','integer'],
            'type'          => ['required','in:unset,pc,svr'],
            'name'          => ['required','string'],
            'internal_ip'   => ['nullable','string'],
            'port'          => ['nullable','integer'],
            'is_online'     => ['required','integer'],
            'status'        => ['required','in:active,closed,fire,error'],
            'started_at'    => ['nullable','date'],
            'ended_at'      => ['nullable','date'],
        ];
    }
}
