package com.zfire.jiasm.syncdata.constant;

import lombok.Getter;

/**
 * 工单派工状态
 * @author yaozx
 * @version 1.0
 * @date 2023-03-01
 */
@Getter
public enum OrderPGStatusEnum {

    /**
     * 预保存工单
     */
    INSTALL_PG_STATUS_P1100("A01","预保存工单"),

    /**
     * 已保存工单
     */
    INSTALL_PG_STATUS_P1101("A02","已保存工单"),

    /**
     * 待分部派工
     */
    INSTALL_PG_STATUS_P1121("A03","待分部派工"),

    /**
     * 待分部预派工
     */
    INSTALL_PG_STATUS_P1122("A04","待分部预派工"),

    /**
     * 格力品牌省份信息接口
     */
    INSTALL_PG_STATUS_P1125("A05","待分中心派工"),

    /**
     * 待网点派工
     */
    INSTALL_PG_STATUS_P1129("A06","待网点派工"),

    /**
     * 待网点预派工
     */
    INSTALL_PG_STATUS_P1130("A07","待网点预派工"),

    /**
     * 待审批改派
     */
    INSTALL_PG_STATUS_P1135("A08","待审批改派"),

    /**
     * 服务人员待接收
     */
    INSTALL_PG_STATUS_P1301("A09","服务人员待接收"),

    /**
     * 服务人员报完工
     */
    INSTALL_PG_STATUS_P1304("A10","服务人员报完工"),

    /**
     * 服务人员申请售后处理
     */
    INSTALL_PG_STATUS_P1307("A11","服务人员申请售后处理"),

    /**
     * 已作废工单
     */
    INSTALL_PG_STATUS_P1308("A12","已作废工单"),

    /**
     * 已关闭工单
     */
    INSTALL_PG_STATUS_P1309("A13","已关闭工单"),





    ;




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


    private final String text;

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

    public static OrderPGStatusEnum getByCode(String code) {
        for (OrderPGStatusEnum 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 (OrderPGStatusEnum item : values()) {
            if (code.equals(item.getCode())) {
                result = item.getText();
                break;
            }
        }
        return result;
    }
}
