package com.shcd.enums;

import java.util.Arrays;
import lombok.Getter;

@Getter
public enum ShorePowerConnRecordInfoEnum {
  SGNH("市管内河",2),
  CM("崇明区",3),
  PD("浦东新区",4),
  BS("宝山区",5),
  JD("嘉定区",6),
  FX("奉贤区",7),
  MH("闵行区",8),
  JS("金山区",9),
  QP("青浦区",10),
  SJ("松江区",11),
  LG("临港新片区", 12);


  private String area;
  private Integer code;

  ShorePowerConnRecordInfoEnum(String area, Integer code) {
    this.area = area;
    this.code = code;
  }

  public static ShorePowerConnRecordInfoEnum getByArea(Integer code) {
    return Arrays.stream(values())
        .filter(shorePowerConnRecordInfoEnum -> shorePowerConnRecordInfoEnum.getCode().equals(code))
        .findFirst().orElse(null);
  }
}
