package com.cm.central.control.service.client;

import com.cm.central.control.pojo.bos.ClientBO;
import com.cm.central.control.pojo.dtos.client.ClientLicenseAuthorizationDTO;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.central.control.pojo.dtos.client.ClientDTO;
import com.cm.central.control.pojo.vos.client.ClientVO;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: IClientService
 * @Description: 客户端
 * @Author: WenG
 * @Date: 2020-07-30 19:12
 * @Version: 1.0
 **/
public interface IClientService {

    /**
     * 客户端密码加密串
     */
    String CLIENT_SECRET_ENCODE_KEY = "_CLIENT__SECRET_";
    /**
     * 秘钥加密串
     */
    String CLIENT_LICENSE_KEY = "_System_License_";

    /**
     * 新增客户端
     *
     * @param clientVO
     * @return
     * @throws Exception
     */
    SuccessResult saveClient(ClientVO clientVO) throws Exception;

    /**
     * 新增客户端(APP)
     *
     * @param token
     * @param clientVO
     * @return
     * @throws Exception
     */
    SuccessResult saveClientByToken(String token, ClientVO clientVO) throws Exception;

    /**
     * 新增客户端
     *
     * @param clientVO
     * @return clientId
     * @throws Exception
     */
    String saveClientReturnId(ClientVO clientVO) throws Exception;

    /**
     * 新增客户端(APP)
     *
     * @param token
     * @param clientVO
     * @return clientId
     * @throws Exception
     */
    String saveClientByTokenReturnId(String token, ClientVO clientVO) throws Exception;

    /**
     * 删除客户端
     *
     * @param ids
     * @return
     * @throws RemoveException
     */
    SuccessResult removeClient(String ids) throws RemoveException;

    /**
     * 删除客户端（物理删除）
     *
     * @param ids
     * @throws RemoveException
     */
    void deleteClient(String ids) throws RemoveException;

    /**
     * 删除客户端(APP)
     *
     * @param token
     * @param ids
     * @return
     * @throws RemoveException
     */
    SuccessResult removeClientByToken(String token, String ids) throws RemoveException;

    /**
     * 修改客户端
     *
     * @param clientId
     * @param clientVO
     * @return
     * @throws Exception
     */
    SuccessResult updateClient(String clientId, ClientVO clientVO) throws Exception;

    /**
     * 修改客户端(APP)
     *
     * @param token
     * @param clientId
     * @param clientVO
     * @return
     * @throws Exception
     */
    SuccessResult updateClientByToken(String token, String clientId, ClientVO clientVO) throws Exception;

    /**
     * 修改客户端授权
     *
     * @param clientId
     * @param clientLicenseAuthorizationDTO
     * @return
     * @throws Exception
     */
    SuccessResult updateClientLicense(String clientId, ClientLicenseAuthorizationDTO clientLicenseAuthorizationDTO) throws Exception;

    /**
     * 客户端详情(通过ID)
     *
     * @param clientId
     * @return
     * @throws SearchException
     */
    ClientDTO getClientById(String clientId) throws SearchException;

    /**
     * 客户端列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<ClientDTO> listClient(Map<String, Object> params) throws SearchException;

    /**
     * 客户端分页列表
     *
     * @param page
     * @return
     * @throws SearchException
     */
    SuccessResultList<List<ClientDTO>> listPageClient(ListPage page) throws SearchException;

    /**
     * 客户端统计
     *
     * @param params
     * @return
     * @throws SearchException
     */
    Integer countNumberClient(Map<String, Object> params) throws SearchException;

    /**
     * 客户端统计
     *
     * @param params
     * @return
     * @throws SearchException
     */
    SuccessResultData<Integer> countClient(Map<String, Object> params) throws SearchException;

    /**
     * 客户端密码(通过ID)
     *
     * @param clientId
     * @return
     * @throws SearchException
     */
    SuccessResultData<String> getClientSecretByClientId(String clientId) throws Exception;

    /**
     * 客户端license授权(通过ID)
     *
     * @param clientId
     * @return
     * @throws SearchException
     */
    ClientLicenseAuthorizationDTO getClientLicenseAuthorizationByClientId(String clientId) throws SearchException;

    /**
     * 获取客户端license
     *
     * @param clientId
     * @return
     * @throws SearchException
     */
    SuccessResultData<String> getClientLicenseByClientId(String clientId) throws SearchException;

    /**
     * 获取客户端license
     *
     * @param clientId
     * @return
     * @throws SearchException
     */
    String getClientLicense(String clientId) throws SearchException;

    /**
     * 获取client详情
     *
     * @param clientId
     * @return
     * @throws SearchException
     */
    ClientBO getClientBOByClientId(String clientId) throws SearchException;

    /**
     * 获取客户端服务器信息
     *
     * @param clientId
     * @return
     */
    SuccessResultData<Map<String, Object>> getClientInfoByClientId(String clientId) throws SearchException;
}