package org.dromara.elevator.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.dromara.common.core.utils.StringUtils;

import java.util.Arrays;

/**
 * 区域客户端枚举
 *
 * @author ym
 * @version 1.0.0
 * @date 2024-11-14 14:30
 */
@Getter
@AllArgsConstructor
public enum AreaClientEnum {

    /**
     * 武汉
     */
    WH("1","4861fee8e89d4d638be4041ae6f97970", "3c0174def53a44008395f91f232bb579",
        "https://ele.secp.com.cn/oauth/tooken.do",
        "https://ele.secp.com.cn/androidui/CameraInfo.html?accessToken=%s&eleId=%s&ruantongFlag=1&ptzControl=1&status=1#index_section","武汉"),

    /**
     * 荆门
     */
    JM("2","91982cfff13d48e7876c1a83f526073c", "62bdef55b5864d308d930bd19e5648df",
        "https://dt.hbyuan.com.cn/oauth/tooken.do",
        "https://dt.hbyuan.com.cn/androidui/CameraInfo.html?accessToken=%s&eleId=%s&ruantongFlag=1&ptzControl=1&status=1#index_section","荆门");

    /**
     * 区域code
     */
    private final String code;

    /**
     * 客户端id
     */
    private final String clineId;

    /**
     * 秘钥
     */
    private final String clientSecret;

    /**
     * 请求Token Url
     */
    private final String requestTokenUrl;

    /**
     * 监控url
     */
    private final String monitorUrl;

    /**
     * 描述
     */
    private final String desc;

    /**
     * 根据code获取客户端信息
     *
     * @param code 区域code
     * @return 客户端信息
     */
    public static AreaClientEnum getAreaClient(String code) {
       return Arrays.stream(values()).filter(item -> StringUtils.equals(item.getCode(), code)).findFirst().orElse(null);
    }

}
