package com.winsun.constant;

/**
 * 订单类型
 */
public enum OrderType {

    ZERO("0", "新用户办卡"),
    ONE("1", "放号登记"),
    TWO("2","存量升级"),
    THREE("3", "小白卡"),
    FOUR("4", "羊城通"),
    FIVE("5", "线上预制卡"),
    SIX("6", "线上小白卡"),
    SEVEN("7", "自助终端");

    private String code;

    private String name;

    private OrderType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByCode(String code) {
        OrderType[] values = values();
        for(OrderType orderType : values) {
            if (orderType.getCode().equals(code)) {
                return orderType.getName();
            }
        }
        return "";
    }

    public static String getCodeByName(String name) {
        OrderType[] values = values();
        for(OrderType orderType : values) {
            if (orderType.getName().equals(name)) {
                return orderType.getCode();
            }
        }
        return "";
    }
}

