<?php

namespace  App\Http\Requests\OpenWork\Corp;

use App\Http\Requests\BaseRequest;

/**
 * 账号管理接口校验规则
 * @author  唐远望
 * @date    2025-03-29
 * */
class LicenseAccount extends BaseRequest
{

    /**
     *
     * @return  array
     */
    public  function  rules()
    {
        // 规则
        return [
            'corpid'              => 'required',
            'order_id'      => 'required|string',
            'transfer_list' => 'required|array',
            'transfer_list.*.handover_userid' => 'required|string',
            'transfer_list.*.takeover_userid' => 'required|string',
            'active_code' => 'required|string',
            'userid'    => 'required|string',
            'page'      => 'required|integer',
            'limit'     => 'required|integer',
            'type'      => 'integer|in:1,2',
        ];
    }

    // 场景列表
    protected   $scenes         = [
        'get_active_code_info'                      => ['corpid', 'active_code'],
        'get_user_active_info'                      => ['corpid', 'userid'],
        'inheritance'                      => ['corpid', 'transfer_list'],
        'account_list'                      => ['page', 'limit'],
        'get_active_code_list'                      => ['corpid', 'page', 'limit','type'],
    ];

    /**
     *
     * @return  array
     */
    public  function  messages()
    {
        return [
            'corpid.required'     => '授权方corpid不能为空',
            'userid.required'     => '用户账号不能为空',
            'active_code.required'     => '激活码不能为空',
            'transfer_list.required'     => '转移列表不能为空',
            'transfer_list.*.handover_userid.required'     => '移交方账号不能为空',
            'transfer_list.*.takeover_userid.required'     => '接管方账号不能为空',
            'userid.required'     => '用户账号不能为空',
            'page.required'     => '页码不能为空',
            'limit.required'     => '每页条数不能为空',
            'type.in'     => '类型错误',
        ];
    }
}
