package com.oqpo.api.enums;

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

public enum PodrPssblDvsn {

    PODR_Y("PO01", "발주가능"), //
    PODR_N("PO02", "발주불가")
    ;

    PodrPssblDvsn(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) {
        PodrPssblDvsn[] values = PodrPssblDvsn.values();
        for (PodrPssblDvsn icd : values) {
            if (icd.name.equals(nname)) {
                return icd.cd;
            }
        }
        return nname;
    }

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

}
