package com.kamco.cd.training.log.dto;

import com.kamco.cd.training.common.utils.enums.CodeExpose;
import com.kamco.cd.training.common.utils.enums.EnumType;
import lombok.AllArgsConstructor;
import lombok.Getter;

@CodeExpose
@Getter
@AllArgsConstructor
public enum EventType implements EnumType {
  LIST("목록"),
  DETAIL("상세"),
  POPUP("팝업"),
  STATUS("상태"),
  ADDED("추가"),
  MODIFIED("수정"),
  REMOVE("삭제"),
  DOWNLOAD("다운로드"),
  LOGIN("로그인"),
  OTHER("기타");

  private final String desc;

  public static EventType fromName(String name) {
    try {
      return EventType.valueOf(name.toUpperCase());
    } catch (Exception e) {
      return OTHER;
    }
  }

  @Override
  public String getId() {
    return name();
  }

  @Override
  public String getText() {
    return desc;
  }
}
