001package com.box.sdkgen.schemas.metadatafieldfilterdaterange;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.internal.utils.DateTimeUtils;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
008import com.fasterxml.jackson.databind.annotation.JsonSerialize;
009import java.time.OffsetDateTime;
010import java.util.Objects;
011
012/**
013 * Specifies which `date` field on the template to filter the search results by, specifying a range
014 * of dates that can match.
015 */
016@JsonFilter("nullablePropertyFilter")
017public class MetadataFieldFilterDateRange extends SerializableObject {
018
019  /**
020   * Specifies the (inclusive) upper bound for the metadata field value. The value of a field must
021   * be lower than (`lt`) or equal to this value for the search query to match this template.
022   */
023  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
024  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
025  protected OffsetDateTime lt;
026
027  /**
028   * Specifies the (inclusive) lower bound for the metadata field value. The value of a field must
029   * be greater than (`gt`) or equal to this value for the search query to match this template.
030   */
031  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
032  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
033  protected OffsetDateTime gt;
034
035  public MetadataFieldFilterDateRange() {
036    super();
037  }
038
039  protected MetadataFieldFilterDateRange(Builder builder) {
040    super();
041    this.lt = builder.lt;
042    this.gt = builder.gt;
043    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
044  }
045
046  public OffsetDateTime getLt() {
047    return lt;
048  }
049
050  public OffsetDateTime getGt() {
051    return gt;
052  }
053
054  @Override
055  public boolean equals(Object o) {
056    if (this == o) {
057      return true;
058    }
059    if (o == null || getClass() != o.getClass()) {
060      return false;
061    }
062    MetadataFieldFilterDateRange casted = (MetadataFieldFilterDateRange) o;
063    return Objects.equals(lt, casted.lt) && Objects.equals(gt, casted.gt);
064  }
065
066  @Override
067  public int hashCode() {
068    return Objects.hash(lt, gt);
069  }
070
071  @Override
072  public String toString() {
073    return "MetadataFieldFilterDateRange{" + "lt='" + lt + '\'' + ", " + "gt='" + gt + '\'' + "}";
074  }
075
076  public static class Builder extends NullableFieldTracker {
077
078    protected OffsetDateTime lt;
079
080    protected OffsetDateTime gt;
081
082    public Builder lt(OffsetDateTime lt) {
083      this.lt = lt;
084      return this;
085    }
086
087    public Builder gt(OffsetDateTime gt) {
088      this.gt = gt;
089      return this;
090    }
091
092    public MetadataFieldFilterDateRange build() {
093      return new MetadataFieldFilterDateRange(this);
094    }
095  }
096}