content: /*
   * Copyright 2024-2024 the original author or authors.
   */
  
  package com.alibaba.langengine.modelcontextprotocol.spec;
  
  import lombok.Data;
  
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import com.fasterxml.jackson.annotation.JsonInclude;
  import com.fasterxml.jackson.annotation.JsonProperty;
  
  import java.util.Objects;
  
  /**
   * A known resource that the server is capable of reading.
   * 
   * JDK 1.8 compatible version.
   */
  @JsonInclude(JsonInclude.Include.NON_ABSENT)
  @JsonIgnoreProperties(ignoreUnknown = true)
  @Data
  public class Resource implements Annotated {
      private final String uri;
      private final String name;
      private final String description;
      private final String mimeType;
      private final Annotations annotations;
  
      public Resource(
              @JsonProperty("uri") String uri,
              @JsonProperty("name") String name,
              @JsonProperty("description") String description,
              @JsonProperty("mimeType") String mimeType,
              @JsonProperty("annotations") Annotations annotations) {
          this.uri = uri;
          this.name = name;
          this.description = description;
          this.mimeType = mimeType;
          this.annotations = annotations;
      }
  
      public String uri() {
          return uri;
      }
  
      public String name() {
          return name;
      }
  
      public String description() {
          return description;
      }
  
      public String mimeType() {
          return mimeType;
      }
  
      @Override
      public Annotations annotations() {
          return annotations;
      }
  
      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          Resource resource = (Resource) o;
          return Objects.equals(uri, resource.uri) &&
                 Objects.equals(name, resource.name) &&
                 Objects.equals(description, resource.description) &&
                 Objects.equals(mimeType, resource.mimeType) &&
                 Objects.equals(annotations, resource.annotations);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(uri, name, description, mimeType, annotations);
      }
  
      @Override
      public String toString() {
          return "Resource{" +
                 "uri='" + uri + '\'' +
                 ", name='" + name + '\'' +
                 ", description='" + description + '\'' +
                 ", mimeType='" + mimeType + '\'' +
                 ", annotations=" + annotations +
                 '}';
      }
  }
  