content: /*
   * Configuration API
   *
   * The version of the OpenAPI document: 2
   *
   *
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  
  package com.adyen.model.balanceplatform;
  
  import com.fasterxml.jackson.annotation.JsonCreator;
  import com.fasterxml.jackson.annotation.JsonInclude;
  import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.annotation.JsonPropertyOrder;
  import com.fasterxml.jackson.annotation.JsonValue;
  import com.fasterxml.jackson.core.JsonProcessingException;
  import java.util.*;
  import java.util.Arrays;
  import java.util.logging.Logger;
  
  /** TransactionRuleInterval */
  @JsonPropertyOrder({
    TransactionRuleInterval.JSON_PROPERTY_DAY_OF_MONTH,
    TransactionRuleInterval.JSON_PROPERTY_DAY_OF_WEEK,
    TransactionRuleInterval.JSON_PROPERTY_DURATION,
    TransactionRuleInterval.JSON_PROPERTY_TIME_OF_DAY,
    TransactionRuleInterval.JSON_PROPERTY_TIME_ZONE,
    TransactionRuleInterval.JSON_PROPERTY_TYPE
  })
  public class TransactionRuleInterval {
    public static final String JSON_PROPERTY_DAY_OF_MONTH = "dayOfMonth";
    private Integer dayOfMonth;
  
    /**
     * The day of week, used when the &#x60;duration.unit&#x60; is **weeks**. If not provided, by
     * default, this is set to **monday**. Possible values: **sunday**, **monday**, **tuesday**,
     * **wednesday**, **thursday**, **friday**.
     */
    public enum DayOfWeekEnum {
      FRIDAY(String.valueOf("friday")),
  
      MONDAY(String.valueOf("monday")),
  
      SATURDAY(String.valueOf("saturday")),
  
      SUNDAY(String.valueOf("sunday")),
  
      THURSDAY(String.valueOf("thursday")),
  
      TUESDAY(String.valueOf("tuesday")),
  
      WEDNESDAY(String.valueOf("wednesday"));
  
      private static final Logger LOG = Logger.getLogger(DayOfWeekEnum.class.getName());
  
      private String value;
  
      DayOfWeekEnum(String value) {
        this.value = value;
      }
  
      @JsonValue
      public String getValue() {
        return value;
      }
  
      @Override
      public String toString() {
        return String.valueOf(value);
      }
  
      @JsonCreator
      public static DayOfWeekEnum fromValue(String value) {
        for (DayOfWeekEnum b : DayOfWeekEnum.values()) {
          if (b.value.equals(value)) {
            return b;
          }
        }
        // handling unexpected value
        LOG.warning(
            "DayOfWeekEnum: unexpected enum value '"
                + value
                + "' - Supported values are "
                + Arrays.toString(DayOfWeekEnum.values()));
        return null;
      }
    }
  
    public static final String JSON_PROPERTY_DAY_OF_WEEK = "dayOfWeek";
    private DayOfWeekEnum dayOfWeek;
  
    public static final String JSON_PROPERTY_DURATION = "duration";
    private Duration duration;
  
    public static final String JSON_PROPERTY_TIME_OF_DAY = "timeOfDay";
    private String timeOfDay;
  
    public static final String JSON_PROPERTY_TIME_ZONE = "timeZone";
    private String timeZone;
  
    /**
     * The [type of interval](https://docs.adyen.com/issuing/transaction-rules#time-intervals) during
     * which the rule conditions and limits apply, and how often counters are reset. Possible values:
     * * **perTransaction**: conditions are evaluated and the counters are reset for every
     * transaction. * **daily**: the counters are reset daily at 00:00:00 CET. * **weekly**: the
     * counters are reset every Monday at 00:00:00 CET. * **monthly**: the counters reset every first
     * day of the month at 00:00:00 CET. * **lifetime**: conditions are applied to the lifetime of the
     * payment instrument. * **rolling**: conditions are applied and the counters are reset based on a
     * &#x60;duration&#x60;. If the reset date and time are not provided, Adyen applies the default
     * reset time similar to fixed intervals. For example, if the duration is every two weeks, the
     * counter resets every third Monday at 00:00:00 CET. * **sliding**: conditions are applied and
     * the counters are reset based on the current time and a &#x60;duration&#x60; that you specify.
     */
    public enum TypeEnum {
      DAILY(String.valueOf("daily")),
  
      LIFETIME(String.valueOf("lifetime")),
  
      MONTHLY(String.valueOf("monthly")),
  
      PERTRANSACTION(String.valueOf("perTransaction")),
  
      ROLLING(String.valueOf("rolling")),
  
      SLIDING(String.valueOf("sliding")),
  
      WEEKLY(String.valueOf("weekly"));
  
      private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName());
  
      private String value;
  
      TypeEnum(String value) {
        this.value = value;
      }
  
      @JsonValue
      public String getValue() {
        return value;
      }
  
      @Override
      public String toString() {
        return String.valueOf(value);
      }
  
      @JsonCreator
      public static TypeEnum fromValue(String value) {
        for (TypeEnum b : TypeEnum.values()) {
          if (b.value.equals(value)) {
            return b;
          }
        }
        // handling unexpected value
        LOG.warning(
            "TypeEnum: unexpected enum value '"
                + value
                + "' - Supported values are "
                + Arrays.toString(TypeEnum.values()));
        return null;
      }
    }
  
    public static final String JSON_PROPERTY_TYPE = "type";
    private TypeEnum type;
  
    public TransactionRuleInterval() {}
  
    /**
     * The day of month, used when the &#x60;duration.unit&#x60; is **months**. If not provided, by
     * default, this is set to **1**, the first day of the month.
     *
     * @param dayOfMonth The day of month, used when the &#x60;duration.unit&#x60; is **months**. If
     *     not provided, by default, this is set to **1**, the first day of the month.
     * @return the current {@code TransactionRuleInterval} instance, allowing for method chaining
     */
    public TransactionRuleInterval dayOfMonth(Integer dayOfMonth) {
      this.dayOfMonth = dayOfMonth;
      return this;
    }
  
    /**
     * The day of month, used when the &#x60;duration.unit&#x60; is **months**. If not provided, by
     * default, this is set to **1**, the first day of the month.
     *
     * @return dayOfMonth The day of month, used when the &#x60;duration.unit&#x60; is **months**. If
     *     not provided, by default, this is set to **1**, the first day of the month.
     */
    @JsonProperty(JSON_PROPERTY_DAY_OF_MONTH)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public Integer getDayOfMonth() {
      return dayOfMonth;
    }
  
    /**
     * The day of month, used when the &#x60;duration.unit&#x60; is **months**. If not provided, by
     * default, this is set to **1**, the first day of the month.
     *
     * @param dayOfMonth The day of month, used when the &#x60;duration.unit&#x60; is **months**. If
     *     not provided, by default, this is set to **1**, the first day of the month.
     */
    @JsonProperty(JSON_PROPERTY_DAY_OF_MONTH)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setDayOfMonth(Integer dayOfMonth) {
      this.dayOfMonth = dayOfMonth;
    }
  
    /**
     * The day of week, used when the &#x60;duration.unit&#x60; is **weeks**. If not provided, by
     * default, this is set to **monday**. Possible values: **sunday**, **monday**, **tuesday**,
     * **wednesday**, **thursday**, **friday**.
     *
     * @param dayOfWeek The day of week, used when the &#x60;duration.unit&#x60; is **weeks**. If not
     *     provided, by default, this is set to **monday**. Possible values: **sunday**, **monday**,
     *     **tuesday**, **wednesday**, **thursday**, **friday**.
     * @return the current {@code TransactionRuleInterval} instance, allowing for method chaining
     */
    public TransactionRuleInterval dayOfWeek(DayOfWeekEnum dayOfWeek) {
      this.dayOfWeek = dayOfWeek;
      return this;
    }
  
    /**
     * The day of week, used when the &#x60;duration.unit&#x60; is **weeks**. If not provided, by
     * default, this is set to **monday**. Possible values: **sunday**, **monday**, **tuesday**,
     * **wednesday**, **thursday**, **friday**.
     *
     * @return dayOfWeek The day of week, used when the &#x60;duration.unit&#x60; is **weeks**. If not
     *     provided, by default, this is set to **monday**. Possible values: **sunday**, **monday**,
     *     **tuesday**, **wednesday**, **thursday**, **friday**.
     */
    @JsonProperty(JSON_PROPERTY_DAY_OF_WEEK)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public DayOfWeekEnum getDayOfWeek() {
      return dayOfWeek;
    }
  
    /**
     * The day of week, used when the &#x60;duration.unit&#x60; is **weeks**. If not provided, by
     * default, this is set to **monday**. Possible values: **sunday**, **monday**, **tuesday**,
     * **wednesday**, **thursday**, **friday**.
     *
     * @param dayOfWeek The day of week, used when the &#x60;duration.unit&#x60; is **weeks**. If not
     *     provided, by default, this is set to **monday**. Possible values: **sunday**, **monday**,
     *     **tuesday**, **wednesday**, **thursday**, **friday**.
     */
    @JsonProperty(JSON_PROPERTY_DAY_OF_WEEK)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setDayOfWeek(DayOfWeekEnum dayOfWeek) {
      this.dayOfWeek = dayOfWeek;
    }
  
    /**
     * duration
     *
     * @param duration
     * @return the current {@code TransactionRuleInterval} instance, allowing for method chaining
     */
    public TransactionRuleInterval duration(Duration duration) {
      this.duration = duration;
      return this;
    }
  
    /**
     * Get duration
     *
     * @return duration
     */
    @JsonProperty(JSON_PROPERTY_DURATION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public Duration getDuration() {
      return duration;
    }
  
    /**
     * duration
     *
     * @param duration
     */
    @JsonProperty(JSON_PROPERTY_DURATION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setDuration(Duration duration) {
      this.duration = duration;
    }
  
    /**
     * The time of day, in **hh:mm:ss** format, used when the &#x60;duration.unit&#x60; is **hours**.
     * If not provided, by default, this is set to **00:00:00**.
     *
     * @param timeOfDay The time of day, in **hh:mm:ss** format, used when the
     *     &#x60;duration.unit&#x60; is **hours**. If not provided, by default, this is set to
     *     **00:00:00**.
     * @return the current {@code TransactionRuleInterval} instance, allowing for method chaining
     */
    public TransactionRuleInterval timeOfDay(String timeOfDay) {
      this.timeOfDay = timeOfDay;
      return this;
    }
  
    /**
     * The time of day, in **hh:mm:ss** format, used when the &#x60;duration.unit&#x60; is **hours**.
     * If not provided, by default, this is set to **00:00:00**.
     *
     * @return timeOfDay The time of day, in **hh:mm:ss** format, used when the
     *     &#x60;duration.unit&#x60; is **hours**. If not provided, by default, this is set to
     *     **00:00:00**.
     */
    @JsonProperty(JSON_PROPERTY_TIME_OF_DAY)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getTimeOfDay() {
      return timeOfDay;
    }
  
    /**
     * The time of day, in **hh:mm:ss** format, used when the &#x60;duration.unit&#x60; is **hours**.
     * If not provided, by default, this is set to **00:00:00**.
     *
     * @param timeOfDay The time of day, in **hh:mm:ss** format, used when the
     *     &#x60;duration.unit&#x60; is **hours**. If not provided, by default, this is set to
     *     **00:00:00**.
     */
    @JsonProperty(JSON_PROPERTY_TIME_OF_DAY)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setTimeOfDay(String timeOfDay) {
      this.timeOfDay = timeOfDay;
    }
  
    /**
     * The [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For example,
     * **Europe/Amsterdam**. By default, this is set to **UTC**.
     *
     * @param timeZone The [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
     *     For example, **Europe/Amsterdam**. By default, this is set to **UTC**.
     * @return the current {@code TransactionRuleInterval} instance, allowing for method chaining
     */
    public TransactionRuleInterval timeZone(String timeZone) {
      this.timeZone = timeZone;
      return this;
    }
  
    /**
     * The [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For example,
     * **Europe/Amsterdam**. By default, this is set to **UTC**.
     *
     * @return timeZone The [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
     *     For example, **Europe/Amsterdam**. By default, this is set to **UTC**.
     */
    @JsonProperty(JSON_PROPERTY_TIME_ZONE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getTimeZone() {
      return timeZone;
    }
  
    /**
     * The [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For example,
     * **Europe/Amsterdam**. By default, this is set to **UTC**.
     *
     * @param timeZone The [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
     *     For example, **Europe/Amsterdam**. By default, this is set to **UTC**.
     */
    @JsonProperty(JSON_PROPERTY_TIME_ZONE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setTimeZone(String timeZone) {
      this.timeZone = timeZone;
    }
  
    /**
     * The [type of interval](https://docs.adyen.com/issuing/transaction-rules#time-intervals) during
     * which the rule conditions and limits apply, and how often counters are reset. Possible values:
     * * **perTransaction**: conditions are evaluated and the counters are reset for every
     * transaction. * **daily**: the counters are reset daily at 00:00:00 CET. * **weekly**: the
     * counters are reset every Monday at 00:00:00 CET. * **monthly**: the counters reset every first
     * day of the month at 00:00:00 CET. * **lifetime**: conditions are applied to the lifetime of the
     * payment instrument. * **rolling**: conditions are applied and the counters are reset based on a
     * &#x60;duration&#x60;. If the reset date and time are not provided, Adyen applies the default
     * reset time similar to fixed intervals. For example, if the duration is every two weeks, the
     * counter resets every third Monday at 00:00:00 CET. * **sliding**: conditions are applied and
     * the counters are reset based on the current time and a &#x60;duration&#x60; that you specify.
     *
     * @param type The [type of
     *     interval](https://docs.adyen.com/issuing/transaction-rules#time-intervals) during which the
     *     rule conditions and limits apply, and how often counters are reset. Possible values: *
     *     **perTransaction**: conditions are evaluated and the counters are reset for every
     *     transaction. * **daily**: the counters are reset daily at 00:00:00 CET. * **weekly**: the
     *     counters are reset every Monday at 00:00:00 CET. * **monthly**: the counters reset every
     *     first day of the month at 00:00:00 CET. * **lifetime**: conditions are applied to the
     *     lifetime of the payment instrument. * **rolling**: conditions are applied and the counters
     *     are reset based on a &#x60;duration&#x60;. If the reset date and time are not provided,
     *     Adyen applies the default reset time similar to fixed intervals. For example, if the
     *     duration is every two weeks, the counter resets every third Monday at 00:00:00 CET. *
     *     **sliding**: conditions are applied and the counters are reset based on the current time
     *     and a &#x60;duration&#x60; that you specify.
     * @return the current {@code TransactionRuleInterval} instance, allowing for method chaining
     */
    public TransactionRuleInterval type(TypeEnum type) {
      this.type = type;
      return this;
    }
  
    /**
     * The [type of interval](https://docs.adyen.com/issuing/transaction-rules#time-intervals) during
     * which the rule conditions and limits apply, and how often counters are reset. Possible values:
     * * **perTransaction**: conditions are evaluated and the counters are reset for every
     * transaction. * **daily**: the counters are reset daily at 00:00:00 CET. * **weekly**: the
     * counters are reset every Monday at 00:00:00 CET. * **monthly**: the counters reset every first
     * day of the month at 00:00:00 CET. * **lifetime**: conditions are applied to the lifetime of the
     * payment instrument. * **rolling**: conditions are applied and the counters are reset based on a
     * &#x60;duration&#x60;. If the reset date and time are not provided, Adyen applies the default
     * reset time similar to fixed intervals. For example, if the duration is every two weeks, the
     * counter resets every third Monday at 00:00:00 CET. * **sliding**: conditions are applied and
     * the counters are reset based on the current time and a &#x60;duration&#x60; that you specify.
     *
     * @return type The [type of
     *     interval](https://docs.adyen.com/issuing/transaction-rules#time-intervals) during which the
     *     rule conditions and limits apply, and how often counters are reset. Possible values: *
     *     **perTransaction**: conditions are evaluated and the counters are reset for every
     *     transaction. * **daily**: the counters are reset daily at 00:00:00 CET. * **weekly**: the
     *     counters are reset every Monday at 00:00:00 CET. * **monthly**: the counters reset every
     *     first day of the month at 00:00:00 CET. * **lifetime**: conditions are applied to the
     *     lifetime of the payment instrument. * **rolling**: conditions are applied and the counters
     *     are reset based on a &#x60;duration&#x60;. If the reset date and time are not provided,
     *     Adyen applies the default reset time similar to fixed intervals. For example, if the
     *     duration is every two weeks, the counter resets every third Monday at 00:00:00 CET. *
     *     **sliding**: conditions are applied and the counters are reset based on the current time
     *     and a &#x60;duration&#x60; that you specify.
     */
    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public TypeEnum getType() {
      return type;
    }
  
    /**
     * The [type of interval](https://docs.adyen.com/issuing/transaction-rules#time-intervals) during
     * which the rule conditions and limits apply, and how often counters are reset. Possible values:
     * * **perTransaction**: conditions are evaluated and the counters are reset for every
     * transaction. * **daily**: the counters are reset daily at 00:00:00 CET. * **weekly**: the
     * counters are reset every Monday at 00:00:00 CET. * **monthly**: the counters reset every first
     * day of the month at 00:00:00 CET. * **lifetime**: conditions are applied to the lifetime of the
     * payment instrument. * **rolling**: conditions are applied and the counters are reset based on a
     * &#x60;duration&#x60;. If the reset date and time are not provided, Adyen applies the default
     * reset time similar to fixed intervals. For example, if the duration is every two weeks, the
     * counter resets every third Monday at 00:00:00 CET. * **sliding**: conditions are applied and
     * the counters are reset based on the current time and a &#x60;duration&#x60; that you specify.
     *
     * @param type The [type of
     *     interval](https://docs.adyen.com/issuing/transaction-rules#time-intervals) during which the
     *     rule conditions and limits apply, and how often counters are reset. Possible values: *
     *     **perTransaction**: conditions are evaluated and the counters are reset for every
     *     transaction. * **daily**: the counters are reset daily at 00:00:00 CET. * **weekly**: the
     *     counters are reset every Monday at 00:00:00 CET. * **monthly**: the counters reset every
     *     first day of the month at 00:00:00 CET. * **lifetime**: conditions are applied to the
     *     lifetime of the payment instrument. * **rolling**: conditions are applied and the counters
     *     are reset based on a &#x60;duration&#x60;. If the reset date and time are not provided,
     *     Adyen applies the default reset time similar to fixed intervals. For example, if the
     *     duration is every two weeks, the counter resets every third Monday at 00:00:00 CET. *
     *     **sliding**: conditions are applied and the counters are reset based on the current time
     *     and a &#x60;duration&#x60; that you specify.
     */
    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setType(TypeEnum type) {
      this.type = type;
    }
  
    /** Return true if this TransactionRuleInterval object is equal to o. */
    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      TransactionRuleInterval transactionRuleInterval = (TransactionRuleInterval) o;
      return Objects.equals(this.dayOfMonth, transactionRuleInterval.dayOfMonth)
          && Objects.equals(this.dayOfWeek, transactionRuleInterval.dayOfWeek)
          && Objects.equals(this.duration, transactionRuleInterval.duration)
          && Objects.equals(this.timeOfDay, transactionRuleInterval.timeOfDay)
          && Objects.equals(this.timeZone, transactionRuleInterval.timeZone)
          && Objects.equals(this.type, transactionRuleInterval.type);
    }
  
    @Override
    public int hashCode() {
      return Objects.hash(dayOfMonth, dayOfWeek, duration, timeOfDay, timeZone, type);
    }
  
    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("class TransactionRuleInterval {\n");
      sb.append("    dayOfMonth: ").append(toIndentedString(dayOfMonth)).append("\n");
      sb.append("    dayOfWeek: ").append(toIndentedString(dayOfWeek)).append("\n");
      sb.append("    duration: ").append(toIndentedString(duration)).append("\n");
      sb.append("    timeOfDay: ").append(toIndentedString(timeOfDay)).append("\n");
      sb.append("    timeZone: ").append(toIndentedString(timeZone)).append("\n");
      sb.append("    type: ").append(toIndentedString(type)).append("\n");
      sb.append("}");
      return sb.toString();
    }
  
    /**
     * Convert the given object to string with each line indented by 4 spaces (except the first line).
     */
    private String toIndentedString(Object o) {
      if (o == null) {
        return "null";
      }
      return o.toString().replace("\n", "\n    ");
    }
  
    /**
     * Create an instance of TransactionRuleInterval given an JSON string
     *
     * @param jsonString JSON string
     * @return An instance of TransactionRuleInterval
     * @throws JsonProcessingException if the JSON string is invalid with respect to
     *     TransactionRuleInterval
     */
    public static TransactionRuleInterval fromJson(String jsonString) throws JsonProcessingException {
      return JSON.getMapper().readValue(jsonString, TransactionRuleInterval.class);
    }
  
    /**
     * Convert an instance of TransactionRuleInterval to an JSON string
     *
     * @return JSON string
     */
    public String toJson() throws JsonProcessingException {
      return JSON.getMapper().writeValueAsString(this);
    }
  }
  