<?php namespace App\Http\Requests\Company;

use App\Http\Requests\BaseRequest;

/**
 * 类型验证器
 * 
 */
class LiveLuckyBag extends BaseRequest
{
    /**
     * 获取应用于请求的规则
     *
     * @return array
     */
    public function rules()
    {
        // 返回结果
        return      [
            // 有时候我们希望某个字段在第一次验证失败后就停止运行验证规则，只需要将 bail 添加到规则中：
            // 验证字段，验证规则，提示信息
	        'name' 			    => 'required',
	        'live_id'           => 'required|integer|gt:0',
            'id'                => 'required|integer|gt:0',
            'prize_type' 		=> 'required|integer|gt:0',
            'prize' 			=> 'required',
            'prize_name' 		=> 'required',
            'number' 			=> 'required|integer|gt:0',
            'password' 			=> 'required',
            'duration' 			=> 'required',
        ];
    }
    
    // 场景列表
    protected   $scenes         = [
		'add'  		            => ['name','live_id','prize_type','prize','number','password','duration','prize_name'],
        'edit'  		        => ['id','name','prize_type','prize','number','password','duration','prize_name'],
        'set_status'  		    => ['id'],
        'details'  		        => ['id'],
        'winning'  		        => ['id'],
	];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'name.required'     => '福袋名称必填',
            'prize_type.required'=> '奖品类型必填',
            'prize_name.required'=> '奖品名称必填',
            'prize.required'    => '奖品必填',
            'number.required'   => '奖品份数必填',
            'password.required' => '口令必填',
            'duration.required' => '持续时间必填',
            'id.required'       => 'ID未知',
            'id.integer'        => 'ID格式错误',
            'id.gt'   		    => 'ID格式错误',
        ];
    }
    
}
