<?php

namespace App\Http\Requests\Company\Vip;

use App\Http\Requests\BaseRequest;

/**
 * VIPConfig
 * @author 刘相欣
 */
class Config extends BaseRequest
{
    /**
     * 获取应用于请求的规则
     *
     * @return array
     */
    public function rules()
    {
        // 返回结果
        return      [
            'id'                => 'required|integer|gt:0',
            'name'              => 'required',
            'is_open'            => 'required|integer|in:0,1',
        ];
    }


    // 场景列表
    protected   $scenes         = [
        'edit'                      => ['id', 'name'],
        'set_status'                => ['id', 'is_open'],
    ];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'id.required'       => 'ID未知',
            'id.integer'        => 'ID格式错误',
            'id.gt'             => 'ID格式错误',

            'name.required'     => '名称必填',

            'is_open.required'  => '开启状态未知',
            'is_open.integer'   => '状态格式错误',
            'is_open.in'        => '状态格式错误',
        ];
    }
}
