package fcb.project.manager.base.enums;

/**
 * 2 * @Author: Abner
 * 3 * @Date: 2021/1/15 12:08
 * 4
 */
public enum  HouseStatus {

      DRAFT(0 , "草稿"),
      WAITING_AUDIT(1 , "待集团审核"),
      WAITING_REGION_AUDIT(3 , "待地区审核"),
      AUDITED(2 , "已上线"),
      REJECT(-1 , "集团驳回"),
      REGION_REJECT(-4 , "地区驳回"),
      ALL(-2 , "全部"),
      OFFLINE(-3 , "下线"),

    ;

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


    public static boolean canDelete(int status){
        if(DRAFT.getCode().compareTo(status) == 0 || REJECT.getCode().compareTo(status) == 0){
            return true;
        }
        return false;
    }

     public static HouseStatus get(Integer key) {
        for (HouseStatus e : HouseStatus.values()) {
            if (e.getCode().equals(key)) {
                return e;
            }
        }
        return HouseStatus.DRAFT;
    }





    private Integer code;
    private String desc;

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
