package cokr.xit.ens.modules.kkomydoc.code;

import cokr.xit.ens.modules.common.code.IntgrnDtlStatCd;
import cokr.xit.ens.modules.common.code.IntgrnDtlStatMapperType;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * <ul>
 * <li>업무 그룹명: 진행상태코드</li>
 * <li>설 명: </li>
 * <li>작성일: 2021. 11. 23. 오후 5:10:35
 * </ul>
 *
 * @author 박민규
 */
@RequiredArgsConstructor
public enum KkoMydocStatusCd implements IntgrnDtlStatMapperType {
    UNKNOWN("알수없음", IntgrnDtlStatCd.UNKNOWN)
    , NULL("입력값 없음", IntgrnDtlStatCd.ACPT_CMPLT)


    , UNIDENTIFIED_USER("비회원", IntgrnDtlStatCd.UNIDENTIFIED_USER)
    , FORBIDDEN("수신거부", IntgrnDtlStatCd.FORBIDDEN)
    , INVALID_VALUE("파라미터 오류", IntgrnDtlStatCd.INVALID_VALUE)
    , INTERNAL_ERROR("카카오페이 서버 오류", IntgrnDtlStatCd.INTERNAL_ERROR)
    , INVALID_REQUEST("유효하지 않은 요청", IntgrnDtlStatCd.INVALID_REQUEST)
    , UNDER_MAINTENANCE("점검중입니다.", IntgrnDtlStatCd.INTERNAL_ERROR)
    , SENT_FAIL("송신실패", IntgrnDtlStatCd.FAIL)


    , SENT("송신", IntgrnDtlStatCd.SENT)
    , RECEIVED("수신", IntgrnDtlStatCd.RECEIVED)
    , READ("열람", IntgrnDtlStatCd.READ)
    , EXPIRED("만료", IntgrnDtlStatCd.EXPIRED)
    , INTERNAL_SENT_ERR("내부 송신 오류", IntgrnDtlStatCd.INTERNAL_ERROR)
    ;


    @Getter
    private final String codeNm;
    @Getter
    private final IntgrnDtlStatCd intgrnDtlStatCd;

    @Override
    public String getCode() {
        return this.name();
    }


    public static KkoMydocStatusCd valueOfEnum(String statCd) {
        if (statCd == null)
            return KkoMydocStatusCd.UNKNOWN;

        KkoMydocStatusCd docBoxStatusCd = null;
        try {
            docBoxStatusCd = KkoMydocStatusCd.valueOf(statCd);
        } catch (IllegalArgumentException e) {
            docBoxStatusCd = KkoMydocStatusCd.UNKNOWN;
        }
        return docBoxStatusCd;
    }


    public static KkoMydocStatusCd getEnum(String value) {
        for(KkoMydocStatusCd v : values())
            if(v.getCode().equalsIgnoreCase(value)) return v;
        throw new IllegalArgumentException();
    }
}
