package com.zfire.jiasm.syncdata.constant;

import lombok.Getter;

/**
 * 工单当前派工状态
 * @author yaozx
 * @version 1.0
 * @date 2023-02-23
 */
@Getter
public enum DispatchStatusEnum {
    /**
     * 待签收
     */
    INSTALL_DISPATCH_STATUS_0("A0","待签收"),

    /**
     * 待签到
     */
    INSTALL_DISPATCH_STATUS_1("A1","待签到"),

    /**
     * 待采集
     */
    INSTALL_DISPATCH_STATUS_2("A2","待采集"),

    /**
     * 已采集
     */
    INSTALL_DISPATCH_STATUS_3("A3","已采集"),

    /**
     * 已报完工
     */
    INSTALL_DISPATCH_STATUS_4("A4","已报完工"),

    /**
     * 服务人员申请改约
     */
    INSTALL_DISPATCH_STATUS_5("A5","服务人员申请改约"),

    /**
     * 服务人员申请改派
     */
    INSTALL_DISPATCH_STATUS_6("A6","服务人员申请改派"),




    ;




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


    private final String text;

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

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