package com.cool.store.enums;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public enum SignTypeEnum {
    TRANSFER(0,"转让","A104"),
    NEW_SIGNING(1,"新签","A101"),
    RENEWAL(2,"续签","A102"),
    RELOCATION (3,"迁址","A103"),
    NEW_SIGNING_INDUSTRIES(5,"新签同异业转化","A105"),

    ;

    private Integer code;
    private String desc;
    private String sap;


    SignTypeEnum(Integer code, String desc,String sap) {
        this.code = code;
        this.desc = desc;
        this.sap =sap;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getSap() {
        return sap;
    }

    public void setSap(String sap) {
        this.sap = sap;
    }

    protected static final Map<Integer, SignTypeEnum> map = Arrays.stream(values()).collect(
            Collectors.toMap(SignTypeEnum::getCode, Function.identity()));

    public static SignTypeEnum getWorkflowStageByCode(Integer code) {
        if(code == null) {
            return null;
        }
        return map.get(code);
    }
}
