<?php

namespace App\Http\Requests\ReportStatistics\Backend;

use App\Http\Requests\BaseRequest;

/**
 * 活跃用户
 * @author 唐远望
 * @version 1.0
 * @date 2025-07-10
 * 
 */
class ActiveUsers extends BaseRequest
{
    /**
     * 获取应用于请求的规则
     *
     * @return array
     */
    public function rules()
    {
        // 返回结果
        return      [
            'name'                 => 'required',
            'id'                => 'required|integer|gt:0',
            'status'            => 'required|integer|in:0,1,2,3',
            'page'              => 'integer|min:1',
            'limit'             => 'integer|min:1',
            'company_id'        => 'required|integer|gt:0',
            'user_id'           => 'required|integer|gt:0',
            'start_time'        => 'date|before_or_equal:end_time',
            'end_time'          => 'date|after_or_equal:start_time',
        ];
    }


    // 场景列表
    protected   $scenes         = [
        'detail'             => [],
        'list'               => ['page', 'limit'],
        'add'                      => ['company_id', 'user_id'],
        'delete'                  => ['id'],
        'edit'                      => [],
        'get_statistics'         => ['start_time', 'end_time'],
        'custom_day_active'     => ['start_time', 'end_time'],
    ];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @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'         => '每页数量格式错误',
            'company_id.required'   => '公司ID未知',
            'company_id.integer'    => '公司ID格式错误',
            'company_id.gt'         => '公司ID格式错误',
            'user_id.required'      => '用户ID未知',
            'user_id.integer'       => '用户ID格式错误',
            'user_id.gt'            => '用户ID格式错误',
            'start_time.date'       => '开始时间格式错误',
            'start_time.before_or_equal' => '开始时间格式错误',
            'end_time.date'         => '结束时间格式错误',
            'end_time.after_or_equal'   => '结束时间格式错误',
        ];
    }
}
