<?php

declare(strict_types=1);

namespace App\Request;

use App\Constants\HttpEnumCode;
use Hyperf\Validation\Request\FormRequest;

class SystemRequest extends FormRequest
{
    protected array $scenes = [
        'getSystemInquiryTime' => [ // 获取系统问诊配置 快速问诊-问诊购药
            'inquiry_type', // 订单类型（1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药）
            'inquiry_mode', // 订单问诊方式（1:图文 2:视频 3:语音 4:电话 5:会员）
        ],
    ];

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'inquiry_type' => 'required|integer|min:1|max:4',
            'inquiry_mode' => 'required|integer|min:1|max:5',
        ];
    }

    /**
     * 获取已定义验证规则的错误消息.
     */
    public function messages(): array
    {
        return [
            'inquiry_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
            'inquiry_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
            'inquiry_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
            'inquiry_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
            'inquiry_mode.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
            'inquiry_mode.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
            'inquiry_mode.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
            'inquiry_mode.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
        ];
    }
}
