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 io.swagger.v3.oas.annotations.media.Schema;
021
022/**
023 * GADM level.
024 */
025public class Gadm {
026
027  private GadmFeature level0;
028
029  private GadmFeature level1;
030
031  private GadmFeature level2;
032
033  private GadmFeature level3;
034
035  @Schema(
036    description = "The top-level division for a country, territory or island.\n\n" +
037      "This is usually a three-letter code from ISO 3166."
038  )
039  public GadmFeature getLevel0() {
040    return level0;
041  }
042
043  public void setLevel0(GadmFeature level0) {
044    this.level0 = level0;
045  }
046
047  @Schema(
048    description = "The first-level division from the GADM database."
049  )
050  public GadmFeature getLevel1() {
051    return level1;
052  }
053
054  public void setLevel1(GadmFeature level1) {
055    this.level1 = level1;
056  }
057
058  @Schema(
059    description = "The second-level division from the GADM database."
060  )
061  public GadmFeature getLevel2() {
062    return level2;
063  }
064
065  public void setLevel2(GadmFeature level2) {
066    this.level2 = level2;
067  }
068
069  @Schema(
070    description = "The third-level division from the GADM database."
071  )
072  public GadmFeature getLevel3() {
073    return level3;
074  }
075
076  public void setLevel3(GadmFeature level3) {
077    this.level3 = level3;
078  }
079
080  @Override
081  public boolean equals(Object o) {
082    if (this == o) return true;
083    if (o == null || getClass() != o.getClass()) return false;
084    Gadm gadm = (Gadm) o;
085    return Objects.equals(level0, gadm.level0) &&
086      Objects.equals(level1, gadm.level1) &&
087      Objects.equals(level2, gadm.level2) &&
088      Objects.equals(level3, gadm.level3);
089  }
090
091  @Override
092  public int hashCode() {
093    return Objects.hash(level0, level1, level2, level3);
094  }
095
096  @Override
097  public String toString() {
098    return "Gadm{" +
099      "level0=" + level0 +
100      ", level1=" + level1 +
101      ", level2=" + level2 +
102      ", level3=" + level3 +
103      '}';
104  }
105}