<?php

namespace App\Http\Requests\QuestionBank\QuestionBackend;

use App\Http\Requests\BaseRequest;

/**
 * 科目VIP接口验证
 * @author 唐远望
 * @version 1.0
 * @date 2025-05-24
 * 
 */
class ShareSubjectVip extends BaseRequest
{
    /**
     * 获取应用于请求的规则
     *
     * @return array
     */
    public function rules()
    {
        // 返回结果
        return      [
            'name'                 => 'required',
            'id'                => 'required|integer|gt:0',
            'status'            => 'required|integer|in:0,1',
            'page'              => 'integer|min:1',
            'limit'             => 'integer|min:1',
            'subject_id'        => 'required|integer|gt:0',
        ];
    }


    // 场景列表
    protected   $scenes         = [
        'detail'             => ['id'],
        'list'               => ['page', 'limit'],
        'add'                      => ['order_id', 'vip_start_time', 'vip_end_time', 'subject_id'],
        'edit'                  => ['id', 'order_id', 'vip_start_time', 'vip_end_time', 'subject_id'],
        'set_status'              => ['id', 'status'],
        'delete'                  => ['id'],
        'unlock_subject_vip'      => ['subject_id'],
    ];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'name.required'     => '名称必填',
            'id.required'       => 'ID未知',
            'id.integer'        => 'ID格式错误',
            'id.gt'               => 'ID格式错误',
            'status.required'   => '状态未知',
            'status.integer'    => '状态格式错误',
            'status.in'         => '状态格式错误',
            'page.integer'      => '页码格式错误',
            'page.min'          => '页码格式错误',
            'limit.integer'     => '每页数量格式错误',
            'limit.min'         => '每页数量格式错误',
            'subject_id.required'   => '科目ID未知',
            'subject_id.integer'    => '科目ID格式错误',
            'subject_id.gt'         => '科目ID格式错误',
            'order_id.required'     => '订单ID未知',
            'order_id.integer'      => '订单ID格式错误',
            'order_id.gt'           => '订单ID格式错误',
            'vip_start_time.required'     => 'VIP开始时间未知',
            'vip_start_time.date_format'  => 'VIP开始时间格式错误',
            'vip_end_time.required'       => 'VIP结束时间未知',
            'vip_end_time.date_format'    => 'VIP结束时间格式错误',
        ];
    }
}
