class Link extends BfObject {

  public static LinkType interfaceTypesToLinkType(
      InterfaceType iface1type, InterfaceType iface2type) {

    if (iface1type != iface2type) {
      return LinkType.UNKNOWN;
    }

    switch (iface1type) {
      case PHYSICAL:
      case LOGICAL:
        return LinkType.PHYSICAL;

      case AGGREGATED:
      case AGGREGATE_CHILD:
      case REDUNDANT:
      case REDUNDANT_CHILD:
      case TUNNEL:
      case VLAN:
      case VPN:
        return LinkType.VIRTUAL;

        // loopback and null shouldn't really happen; lets call it unknown
      case LOOPBACK:
      case NULL:
      case UNKNOWN:
        return LinkType.UNKNOWN;

      default:
        throw new IllegalArgumentException(String.format("Unknown InterfaceType: %s", iface1type));
    }
  }

  public  Link(String srcId, String dstId);
  public  Link(String srcId, String dstId, LinkType type);
  @JsonCreator public  Link(
      @JsonProperty(PROP_ID) String id,
      @JsonProperty(PROP_SRC_ID) String srcId,
      @JsonProperty(PROP_DST_ID) String dstId,
      @JsonProperty(PROP_TYPE) LinkType type);

}