package cokr.xit.ens.modules.nvsigntalk.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 NvSigntalkStatusCd implements IntgrnDtlStatMapperType {
    UNKNOWN("알수없음", IntgrnDtlStatCd.UNKNOWN)
    , NULL("입력값 없음", IntgrnDtlStatCd.ACPT_CMPLT)


    , sent("송신", IntgrnDtlStatCd.SENT)
    , invalid_param("파라미터 오류", IntgrnDtlStatCd.INVALID_VALUE)
    , forbidden_user("허용되지 않은 사용자", IntgrnDtlStatCd.FORBIDDEN_USER)
    , not_found_user("비회원", IntgrnDtlStatCd.UNIDENTIFIED_USER)
    , duplicated_client_doc_id("고지서 고유식별값 중복", IntgrnDtlStatCd.INVALID_REQUEST)
    , refused_user("수신거부", IntgrnDtlStatCd.FORBIDDEN)
    , internal_server_error("네이버 서버 오류", IntgrnDtlStatCd.INTERNAL_ERROR)
    , SENT_FAIL("송신실패", IntgrnDtlStatCd.FAIL)


    , pending("수신", IntgrnDtlStatCd.RECEIVED)
    , success("열람", IntgrnDtlStatCd.READ)
    , expired("만료", IntgrnDtlStatCd.EXPIRED)
    , fail("조회에 실패", IntgrnDtlStatCd.FAIL)
//    , invalid_param("조회에 실패(파라미터가 유효하지 않음)", IntgrnDtlStatCd.FAIL)
    , not_registered_user("조회에 실패(고지서에 가입된 사용자가 아님)", IntgrnDtlStatCd.UNIDENTIFIED_USER);


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

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


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

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

}
