001/*
002 * Copyright 2020 Global Biodiversity Information Facility (GBIF)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.gbif.api.model.occurrence;
017
018import java.util.Objects;
019
020import javax.validation.constraints.NotNull;
021
022import io.swagger.v3.oas.annotations.media.Schema;
023
024/**
025 * A <a href="https://gadm.org">GADM</a> region feature.
026 */
027@Schema(
028  description = "A region from the GADM database."
029)
030public class GadmFeature {
031
032  private String gid;
033
034  private String name;
035
036  public GadmFeature() {
037  }
038
039  public GadmFeature(String gid, String name) {
040    this.gid = gid;
041    this.name = name;
042  }
043
044  public GadmFeature(String name) {
045    this.name = name;
046  }
047
048  public String getGid() {
049    return gid;
050  }
051
052  @Schema(
053    description = "The identifier in GADM for the administrative division."
054  )
055  public GadmFeature setGid(String gid) {
056    this.gid = gid;
057    return this;
058  }
059
060  @Schema(
061    description = "The English name in GADM for the administrative division."
062  )
063  @NotNull
064  public String getName() {
065    return name;
066  }
067
068  public GadmFeature setName(String name) {
069    this.name = name;
070    return this;
071  }
072
073  @Override
074  public boolean equals(Object o) {
075    if (this == o) {
076      return true;
077    }
078    if (o == null || getClass() != o.getClass()) {
079      return false;
080    }
081    GadmFeature that = (GadmFeature) o;
082    return gid == that.gid &&
083      Objects.equals(name, that.name);
084  }
085
086  @Override
087  public int hashCode() {
088    return Objects.hash(gid, name);
089  }
090
091  @Override
092  public String toString() {
093    return "GadmFeature{" +
094      "gid='" + gid + '\'' +
095      ", name='" + name + '\'' +
096      '}';
097  }
098}