<?php


namespace app\admin\validate;


class QuestionValidate extends BaseValidate
{

     /**
      * 设置校验规则
      * @var string[]
      */
    protected $rule = [
        'id' => 'require',
        'category_id' => 'require|integer|min:0',
        'question' => 'require|length:1,200',
        'answer' => 'require|length:1,200',
        'question_type' => 'require|integer',
        'keyword_id' => 'integer|min:0',
        'status' => 'integer|min:0',
        'weight' => 'integer|min:0',
    ];

    /**
     * 参数描述
     * @var string[]
     */
    protected $field = [
        'id' => 'id',
        'category_id' => '分类ID',
        'question_type' => '问题类别',
        'question' => '问题',
        'answer' => '回答',
        'keyword_id' => '关键词ID',
        'status' => '状态',
        'weight' => '权重',
    ];

    /**
     * @notes 编辑场景
     */
    public function sceneEdit()
    {
        return $this->only([ 'category_id', 'question_type', 'question', 'answer', 'keyword_id', 'status', 'weight','language_code']);
    }

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

}