<?php

namespace App\Http\Requests\ReportStatistics\Reception;

use App\Http\Requests\BaseRequest;

/**
 * 访问记录
 * @author 唐远望
 * @version 1.0
 * @date 2025-07-09
 * 
 */
class AccessRecords 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',
            'network_code'      => 'required',
            'visit_page_url'    => 'required',
            'page_hierarchy'    => 'required',
            'terminal_type'     => 'required',
            'device_type'       => 'required',
            'province'          => 'required',
            'page_name'         => 'required',
            'is_operate'        => 'required|integer|in:0,1',
        ];
    }


    // 场景列表
    protected   $scenes         = [
        'detail'                => [],
        'list'                  => ['page', 'limit'],
        'add'                   => ['company_id','network_code','visit_page_url','terminal_type','device_type','page_name'],
        'edit'                  => ['id','network_code','is_operate'],
        'delete'                => ['id'],
        'generate_uuid'         => [],
    ];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @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'         => '每页数量格式错误',
            'network_code.required' => '网络类型未知',
            'visit_page_url.required' => '访问页面URL未知',
            'page_hierarchy.required' => '页面层级未知',
            'terminal_type.required' => '终端类型未知',
            'device_type.required' => '设备类型未知',
            'page_name.required' => '页面名称未知',
        ];
    }
}
