package com.sjyt.icom.asst.common.enums;

import cn.hutool.core.util.ObjectUtil;
import com.sjyt.icom.asst.common.exception.CmdCategoryException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Cmd枚举
 *
 * @author renyanru
 * @version V1.0.0
 * @date 2022/6/8 16:52
 */
@Getter
@AllArgsConstructor
public enum CmdEnum {
  /** 好友关系上报 */
  UP_CONTRACT("15", ""),
  /** 日志信息上报 */
  UP_LOG("16", ""),
  /** 视频通话 */
  V("17", ""),
  /** 语音通话 */
  A("18", "");
  final String code;
  final String claas;

  public static CmdEnum of(String code) {
    CmdEnum[] values = CmdEnum.values();
    for (CmdEnum value : values) {
      if (ObjectUtil.equals(code, value.code)) {
        return value;
      }
    }
    throw new CmdCategoryException("cmd类型异常");
  }
}
