package com.zfire.jiasm.syncdata.constant;

import lombok.Getter;

/**
 * 工单类型
 * @author yaozx
 * @version 1.0
 * @date 2023-02-22
 */
@Getter
public enum OrderTypeEnum {
    ORDER_TYPE_INSTALL("INSTALL","安装单"),
    ORDER_TYPE_REPAIR("REPAIR","维修单"),
    ORDER_TYPE_RECOVERY("RECOVERY","回收工单"),
    ORDER_TYPE_RETURN_EXCHANGE("RETURN_EXCHANGE","退换货"),
    ORDER_TYPE_TRADE_IN("TRADE_IN","以旧换新"),
    ORDER_TYPE_MAINTENANCE("MAINTENANCE","维保工单"),


    YJHX_JDD_TABLE_NAME("yjhx_appraise","以旧换新鉴定单表"),
    ORDER_SALE_TYPE1("以旧换新","以旧换新"),
    ORDER_SALE_TYPE2("格力商城-以旧换新","格力商城-以旧换新"),
    ORDER_SALE_TYPE3("格力商城-以旧换新2","格力商城-以旧换新2"),




    ;




    /**
     * 编码
     */
    private final String code;


    private final String text;

    OrderTypeEnum(String code, String text) {
        this.code = code;
        this.text = text;
    }

    public static OrderTypeEnum getByCode(String code) {
        for (OrderTypeEnum item : values()) {
            if (code.equals(item.getCode())) {
                return item;
            }
        }
        return null;
    }

    /**
     * @param code: code
     * @return 对应枚举
     **/
    public static String getMessageByCode(String code) {
        String result = null;
        for (OrderTypeEnum item : values()) {
            if (code.equals(item.getCode())) {
                result = item.getText();
                break;
            }
        }
        return result;
    }
}
