package com.sckw.core.model.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public enum ProjectStatusEnum {
    /**
     *
     */
    SET_UP(0, "立项"),
    RUNNING(1, "施工中"),
    FINISH(2, "已竣工"),
    ;
    public static Map<Integer, ProjectStatusEnum> MAPS = new HashMap<>();

    static {
        for (ProjectStatusEnum e : values()) {
            MAPS.put(e.getCode(), e);
        }
    }

    private final Integer code;
    private final String name;

    ProjectStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ProjectStatusEnum codeOf(Integer code) {
        for (ProjectStatusEnum logisticsOrderEnum : ProjectStatusEnum.values()) {
            if (logisticsOrderEnum.getCode().equals(code)) {
                return logisticsOrderEnum;
            }
        }
        return null;
    }

    public static ProjectStatusEnum getProjectStatusEnumByCode(Integer code) {
        for (ProjectStatusEnum logisticsOrderEnum : ProjectStatusEnum.values()) {
            if (logisticsOrderEnum.getCode().equals(code)) {
                return logisticsOrderEnum;
            }
        }
        return null;
    }

    public static  String getDestination(Integer code){
        for (ProjectStatusEnum logisticsOrderEnum : ProjectStatusEnum.values()) {
            if (logisticsOrderEnum.getCode().equals(code)) {
                return logisticsOrderEnum.getName();
            }
        }
        return null;
    }

    public static  String getName(Integer code){
        for (ProjectStatusEnum logisticsOrderEnum : ProjectStatusEnum.values()) {
            if (logisticsOrderEnum.getCode().equals(code)) {
                return logisticsOrderEnum.getName();
            }
        }
        return null;
    }
}
