<?php


namespace app\admin\validate;


class GuessAskValidate extends BaseValidate
{

     /**
      * 设置校验规则
      * @var string[]
      */
    protected $rule = [
        'id' => 'require',
        'guess_ask_id' => 'integer|min:0',
        'name' => 'require|length:1,100',
        'type' => 'require|integer|min:0',
        'is_rec' => 'integer|in:0,1',
        'is_top' => 'integer|in:0,1',
        'status' => 'integer|in:0,1',
        'weight' => 'require|integer|min:0',
        'field' => 'require|in:is_rec,is_top,status',
    ];
    

    /**
     * 参数描述
     * @var string[]
     */
    protected $field = [
        'id' => 'id',
        'guess_ask_id' => 'guess_ask_id',
        'name'  => '猜你想问',
        'type' => '问题类别',
        'is_rec' => '是否推荐',
        'is_top' => '是否置顶',
        'status' => '状态',
        'weight' => '权重',
        'field' => '字段',
    ];

    /**
     * @notes 编辑场景
     */
    public function sceneEdit()
    {
        return $this->only(['guess_ask_id', 'name','type', 'is_rec', 'is_top', 'status', 'weight', 'language_code']);
    }

    public function sceneId()
    {
        return $this->only(['id']);
    }

    public function sceneStatus()
    {
        return $this->only(['id', 'field']);
    }

}