<?php

namespace App\Http\Requests\QuestionBank\QuestionReception;

use App\Http\Requests\BaseRequest;

/**
 * 用户分享报表接口验证
 * @author 唐远望
 * @version 1.0
 * @date 2025-05-21
 * 
 */
class UserShareForms 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',
            'allow_unlocking_chapter_count' => 'integer|min:0',
            'number_of_unlocked_chapters' => 'integer|min:0',
            'number_of_invitations' => 'integer|min:0',
            'unlocked_courses_user_number' => 'integer|min:0',
        ];
    }


    // 场景列表
    protected   $scenes         = [
        'detail'             => [],
        'list'               => ['page', 'limit'],
        'add'                      => ['allow_unlocking_chapter_count', 'number_of_unlocked_chapters', 'number_of_invitations', 'unlocked_courses_user_number'],
        'edit'                  => ['id','allow_unlocking_chapter_count', 'number_of_unlocked_chapters', 'number_of_invitations', 'unlocked_courses_user_number'],
        'set_status'              => ['id', 'status'],
        'delete'                  => ['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'         => '每页数量格式错误',
            'allow_unlocking_chapter_count.integer' => '可解锁章节数格式错误',
            'allow_unlocking_chapter_count.min' => '可解锁章节数格式错误',
            'number_of_unlocked_chapters.integer' => '已解锁章节数量格式错误',
            'number_of_unlocked_chapters.min' => '已解锁章节数量格式错误',
            'number_of_invitations.integer' => '邀请数量格式错误',
            'number_of_invitations.min' => '邀请数量格式错误',
            'unlocked_courses_user_number.integer' => '已解锁课程人数格式错误',
            'unlocked_courses_user_number.min' => '已解锁课程人数格式错误',
        ];
    }
}
