package com.oqpo.api.enums;

import com.oqpo.api.exception.GlobalException;
import lombok.Getter;
import lombok.Setter;

public enum ImpDvsn {

    IMP0("IMP0", "국내"), //
    IMP1("IMP1", "수입"), //
    ;

    ImpDvsn(String cd, String nm) {
        this.cd = cd;
        this.name = nm;
    }

    @Getter
    @Setter
    private String cd;

    @Getter
    @Setter
    private String name;

    public static String getCd(String nname) {
        ImpDvsn[] values = ImpDvsn.values();
        for (ImpDvsn icd : values) {
            if (icd.name.equals(nname)) {
                return icd.cd;
            }
        }
        return nname;
    }

    public static String getName(String ccd) {
        ImpDvsn[] values = ImpDvsn.values();
        for (ImpDvsn icd : values) {
            if (icd.cd.equals(ccd)) {
                return icd.name;
            }
        }
        return ccd;
    }

}
