/*
 * The Plaid API
 * The Plaid REST API. Please see https://plaid.com/docs/api for more details.
 *
 * The version of the OpenAPI document: 2020-09-14_1.680.0
 * 
 *
 * 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.plaid.client.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.plaid.client.model.AmountWithCurrency;
import com.plaid.client.model.NegativeBalanceOccurrence;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Insights into negative balance occurrences, including frequency, duration, and minimum balance details.
 */
@ApiModel(description = "Insights into negative balance occurrences, including frequency, duration, and minimum balance details.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-12-11T18:58:39.328614Z[Etc/UTC]")
public class NegativeBalanceInsights {
  public static final String SERIALIZED_NAME_DAYS_SINCE_LAST_OCCURRENCE = "days_since_last_occurrence";
  @SerializedName(SERIALIZED_NAME_DAYS_SINCE_LAST_OCCURRENCE)
  private Integer daysSinceLastOccurrence;

  public static final String SERIALIZED_NAME_DAYS_WITH_NEGATIVE_BALANCE = "days_with_negative_balance";
  @SerializedName(SERIALIZED_NAME_DAYS_WITH_NEGATIVE_BALANCE)
  private Integer daysWithNegativeBalance;

  public static final String SERIALIZED_NAME_MINIMUM_BALANCE = "minimum_balance";
  @SerializedName(SERIALIZED_NAME_MINIMUM_BALANCE)
  private AmountWithCurrency minimumBalance;

  public static final String SERIALIZED_NAME_OCCURRENCES = "occurrences";
  @SerializedName(SERIALIZED_NAME_OCCURRENCES)
  private List<NegativeBalanceOccurrence> occurrences = null;


  public NegativeBalanceInsights daysSinceLastOccurrence(Integer daysSinceLastOccurrence) {
    
    this.daysSinceLastOccurrence = daysSinceLastOccurrence;
    return this;
  }

   /**
   * The number of days since the last transaction that caused any account in the report to have a negative balance.  This value is inclusive of the date of the last negative balance, meaning that if the last negative balance occurred today, this value will be &#x60;0&#x60;.
   * @return daysSinceLastOccurrence
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The number of days since the last transaction that caused any account in the report to have a negative balance.  This value is inclusive of the date of the last negative balance, meaning that if the last negative balance occurred today, this value will be `0`.")

  public Integer getDaysSinceLastOccurrence() {
    return daysSinceLastOccurrence;
  }


  public void setDaysSinceLastOccurrence(Integer daysSinceLastOccurrence) {
    this.daysSinceLastOccurrence = daysSinceLastOccurrence;
  }


  public NegativeBalanceInsights daysWithNegativeBalance(Integer daysWithNegativeBalance) {
    
    this.daysWithNegativeBalance = daysWithNegativeBalance;
    return this;
  }

   /**
   * The number of aggregated days that the accounts in the report has had a negative balance within the given time window.
   * @return daysWithNegativeBalance
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The number of aggregated days that the accounts in the report has had a negative balance within the given time window.")

  public Integer getDaysWithNegativeBalance() {
    return daysWithNegativeBalance;
  }


  public void setDaysWithNegativeBalance(Integer daysWithNegativeBalance) {
    this.daysWithNegativeBalance = daysWithNegativeBalance;
  }


  public NegativeBalanceInsights minimumBalance(AmountWithCurrency minimumBalance) {
    
    this.minimumBalance = minimumBalance;
    return this;
  }

   /**
   * Get minimumBalance
   * @return minimumBalance
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public AmountWithCurrency getMinimumBalance() {
    return minimumBalance;
  }


  public void setMinimumBalance(AmountWithCurrency minimumBalance) {
    this.minimumBalance = minimumBalance;
  }


  public NegativeBalanceInsights occurrences(List<NegativeBalanceOccurrence> occurrences) {
    
    this.occurrences = occurrences;
    return this;
  }

  public NegativeBalanceInsights addOccurrencesItem(NegativeBalanceOccurrence occurrencesItem) {
    if (this.occurrences == null) {
      this.occurrences = new ArrayList<>();
    }
    this.occurrences.add(occurrencesItem);
    return this;
  }

   /**
   * The summary of the negative balance occurrences for this account.  If the user has not had a negative balance in the account in the given time window, this list will be empty.
   * @return occurrences
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The summary of the negative balance occurrences for this account.  If the user has not had a negative balance in the account in the given time window, this list will be empty.")

  public List<NegativeBalanceOccurrence> getOccurrences() {
    return occurrences;
  }


  public void setOccurrences(List<NegativeBalanceOccurrence> occurrences) {
    this.occurrences = occurrences;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    NegativeBalanceInsights negativeBalanceInsights = (NegativeBalanceInsights) o;
    return Objects.equals(this.daysSinceLastOccurrence, negativeBalanceInsights.daysSinceLastOccurrence) &&
        Objects.equals(this.daysWithNegativeBalance, negativeBalanceInsights.daysWithNegativeBalance) &&
        Objects.equals(this.minimumBalance, negativeBalanceInsights.minimumBalance) &&
        Objects.equals(this.occurrences, negativeBalanceInsights.occurrences);
  }

  @Override
  public int hashCode() {
    return Objects.hash(daysSinceLastOccurrence, daysWithNegativeBalance, minimumBalance, occurrences);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class NegativeBalanceInsights {\n");
    sb.append("    daysSinceLastOccurrence: ").append(toIndentedString(daysSinceLastOccurrence)).append("\n");
    sb.append("    daysWithNegativeBalance: ").append(toIndentedString(daysWithNegativeBalance)).append("\n");
    sb.append("    minimumBalance: ").append(toIndentedString(minimumBalance)).append("\n");
    sb.append("    occurrences: ").append(toIndentedString(occurrences)).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    ");
  }

}

