<?php

namespace App\Http\Requests\Company\Custom;

use App\Http\Requests\BaseRequest;

/**
 * 客户标签接口验证
 * @author 唐远望
 * @version 1.0
 * @date 2025-07-15
 * 
 */
class Tag 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',
            'company_id'        => 'required|integer|gt:0',
            'custom_uid'        => 'required|integer|gt:0',
            'tag_id'            => 'required|integer|gt:0',
            'custom_list'       => 'required',
            'tag_list'          => 'required',
            'tag_id_list'       => 'required',
        ];
    }


    // 场景列表
    protected   $scenes         = [
        'detail'             => ['id'],
        'list'               => ['page', 'limit','custom_uid'],
        'add'                      => ['company_id', 'custom_uid', 'tag_id'],
        'edit'                  => ['id', 'tag_id','custom_uid', 'tag_id'],
        'set_status'              => ['id', 'status'],
        'delete'                  => ['id'],
        'batch_add'              => ['company_id', 'custom_list', 'tag_id_list'],
        'batch_remove'           => ['company_id', 'custom_list', 'tag_id_list'],
    ];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @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格式错误',
            'custom_uid.required'   => '客户ID未知',
            'custom_uid.integer'    => '客户ID格式错误',
            'custom_uid.gt'         => '客户ID格式错误',
            'tag_id.required'   => '标签ID未知',
            'tag_id.integer'    => '标签ID格式错误',
            'tag_id.gt'         => '标签ID格式错误',
            'custom_list.required'   => '客户列表未知',
            'tag_list.required'   => '标签列表未知',
            'tag_id_list.required'   => '请选择标签',
        ];
    }
}
