package com.zfire.jiasm.syncdata.constant;


import lombok.Getter;

/**
 * 平台工单当前状态  分两部分(安装与维修)
 * 左则数值为工单系统状态，方便对应处理
 * @author yaozx
 * @version 1.0
 * @date 2023-02-22
 */
@Getter
public enum GDOrderStatusEnum {
    // 安装-工单状态OK
    /**
     * 预保存工单
     */
    INSTALL_STATUS_G1_0("A1100","预保存工单"),

    /**
     * 已保存工单
     */
    INSTALL_STATUS_G1_1("A1101","已保存工单"),

    /**
     * 待分部派工
     */
    INSTALL_STATUS_G2_0("A1121","待分部派工"),

    /**
     * 待分部预派工
     */
    INSTALL_STATUS_G2_1("A1122","待分部预派工"),

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

    /**
     * 待网点派工
     */
    INSTALL_STATUS_G4_0("A1129","待网点派工"),

    /**
     * 待网点预派工
     */
    INSTALL_STATUS_G4_1("A1130","待网点预派工"),

    /**
     * 待审批改派
     */
    INSTALL_STATUS_G5("A1135","待审批改派"),

    /**
     * 服务人员待接收
     */
    INSTALL_STATUS_G6("A1301","服务人员待接收"),

    /**
     * 服务人员报完工
     */
    INSTALL_STATUS_G7("A1304","服务人员报完工"),

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

    /**
     * 已作废工单
     */
    INSTALL_STATUS_G9("A1308","已作废工单"),

    /**
     * 已关闭工单
     */
    INSTALL_STATUS_G10("A1309","已关闭工单"),

    // 维修-工单状态OK
    REPAIR_STATUS_G0("A1101","保存"),
    REPAIR_STATUS_G1("A1101","保存"),
    REPAIR_STATUS_G2("A1121","待分部派工"),
    REPAIR_STATUS_G3("A1129","待分中心派工"),
    REPAIR_STATUS_G4("A1129","待网点派工"),
    REPAIR_STATUS_G5("A1135","待审批改派"),
    REPAIR_STATUS_G6("B6","待审批支援"),
    REPAIR_STATUS_G7("A1301","待服务人员处理"),// 20,21,22,23,24
    REPAIR_STATUS_G8("A1304","服务人员报完工"),
    REPAIR_STATUS_G9("B51","网点报完工"),
    REPAIR_STATUS_G10("B51","分中心报完工"),
    REPAIR_STATUS_G11("B71","分部报完工"),
    REPAIR_STATUS_G12("B100","历史信息"),
    REPAIR_STATUS_G13("B101","批量关闭"),
    REPAIR_STATUS_G14("A1309","正常关闭"),
    REPAIR_STATUS_G15("B103","异常关闭"),


    ;




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


    private final String text;

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

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