<?php

namespace App\Http\Requests\Company\Promoter;

use App\Http\Requests\BaseRequest;
use Illuminate\Validation\Rule;

/**
 * 推广员推广收益记录接口验证
 * @author 唐远望
 * @version 1.0
 * @date 2025-09-15
 * 
 */
class EarningsRecord extends BaseRequest
{
    /**
     * 获取应用于请求的规则
     *
     * @return array
     */
    public function rules()
    {
        // 返回结果
        $rules =      [
            'name'                 => 'required',
            'id'                => 'required|integer|gt:0',
            'page'              => 'integer|min:1',
            'limit'             => 'integer|min:1',
            'status '          => 'integer|in:0,1',
            'promoter_userid'   => 'required|integer|gt:0',
            'audit_status'      => 'integer|in:3,4',
        ];

        return $rules;
    }


    // 场景列表
    protected   $scenes         = [
        'add'             => [],
        'list'             => ['page', 'limit'],
        'apply_list'       => ['page', 'limit'],
        'detail'          => ['id'],
        'set_status'         => ['id', 'status'],
        'audit'           => ['id','audit_status'],
        'export'            =>[],
        'audit_count'  => [],
    ];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @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'         => '每页数量格式错误',
            'promoter_userid.required'   => '推广员ID未知',
            'promoter_userid.integer'    => '推广员ID格式错误',
            'promoter_userid.gt'         => '推广员ID格式错误',
            'audit_status.required'      => '审核状态未知',
            'audit_status.integer'       => '审核状态格式错误',
            'audit_status.in'            => '审核状态格式错误',
        ];
    }
}
