content: /*
   * Adyen Checkout API
   *
   * The version of the OpenAPI document: 71
   *
   *
   * 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.checkout;
  
  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;
  
  /** PlatformChargebackLogic */
  @JsonPropertyOrder({
    PlatformChargebackLogic.JSON_PROPERTY_BEHAVIOR,
    PlatformChargebackLogic.JSON_PROPERTY_COST_ALLOCATION_ACCOUNT,
    PlatformChargebackLogic.JSON_PROPERTY_TARGET_ACCOUNT
  })
  public class PlatformChargebackLogic {
    /**
     * The method of handling the chargeback. Possible values: **deductFromLiableAccount**,
     * **deductFromOneBalanceAccount**, **deductAccordingToSplitRatio**.
     */
    public enum BehaviorEnum {
      DEDUCTACCORDINGTOSPLITRATIO(String.valueOf("deductAccordingToSplitRatio")),
  
      DEDUCTFROMLIABLEACCOUNT(String.valueOf("deductFromLiableAccount")),
  
      DEDUCTFROMONEBALANCEACCOUNT(String.valueOf("deductFromOneBalanceAccount"));
  
      private static final Logger LOG = Logger.getLogger(BehaviorEnum.class.getName());
  
      private String value;
  
      BehaviorEnum(String value) {
        this.value = value;
      }
  
      @JsonValue
      public String getValue() {
        return value;
      }
  
      @Override
      public String toString() {
        return String.valueOf(value);
      }
  
      @JsonCreator
      public static BehaviorEnum fromValue(String value) {
        for (BehaviorEnum b : BehaviorEnum.values()) {
          if (b.value.equals(value)) {
            return b;
          }
        }
        // handling unexpected value
        LOG.warning(
            "BehaviorEnum: unexpected enum value '"
                + value
                + "' - Supported values are "
                + Arrays.toString(BehaviorEnum.values()));
        return null;
      }
    }
  
    public static final String JSON_PROPERTY_BEHAVIOR = "behavior";
    private BehaviorEnum behavior;
  
    public static final String JSON_PROPERTY_COST_ALLOCATION_ACCOUNT = "costAllocationAccount";
    private String costAllocationAccount;
  
    public static final String JSON_PROPERTY_TARGET_ACCOUNT = "targetAccount";
    private String targetAccount;
  
    public PlatformChargebackLogic() {}
  
    /**
     * The method of handling the chargeback. Possible values: **deductFromLiableAccount**,
     * **deductFromOneBalanceAccount**, **deductAccordingToSplitRatio**.
     *
     * @param behavior The method of handling the chargeback. Possible values:
     *     **deductFromLiableAccount**, **deductFromOneBalanceAccount**,
     *     **deductAccordingToSplitRatio**.
     * @return the current {@code PlatformChargebackLogic} instance, allowing for method chaining
     */
    public PlatformChargebackLogic behavior(BehaviorEnum behavior) {
      this.behavior = behavior;
      return this;
    }
  
    /**
     * The method of handling the chargeback. Possible values: **deductFromLiableAccount**,
     * **deductFromOneBalanceAccount**, **deductAccordingToSplitRatio**.
     *
     * @return behavior The method of handling the chargeback. Possible values:
     *     **deductFromLiableAccount**, **deductFromOneBalanceAccount**,
     *     **deductAccordingToSplitRatio**.
     */
    @JsonProperty(JSON_PROPERTY_BEHAVIOR)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public BehaviorEnum getBehavior() {
      return behavior;
    }
  
    /**
     * The method of handling the chargeback. Possible values: **deductFromLiableAccount**,
     * **deductFromOneBalanceAccount**, **deductAccordingToSplitRatio**.
     *
     * @param behavior The method of handling the chargeback. Possible values:
     *     **deductFromLiableAccount**, **deductFromOneBalanceAccount**,
     *     **deductAccordingToSplitRatio**.
     */
    @JsonProperty(JSON_PROPERTY_BEHAVIOR)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setBehavior(BehaviorEnum behavior) {
      this.behavior = behavior;
    }
  
    /**
     * The unique identifier of the balance account to which the chargeback fees are booked. By
     * default, the chargeback fees are booked to your liable balance account.
     *
     * @param costAllocationAccount The unique identifier of the balance account to which the
     *     chargeback fees are booked. By default, the chargeback fees are booked to your liable
     *     balance account.
     * @return the current {@code PlatformChargebackLogic} instance, allowing for method chaining
     */
    public PlatformChargebackLogic costAllocationAccount(String costAllocationAccount) {
      this.costAllocationAccount = costAllocationAccount;
      return this;
    }
  
    /**
     * The unique identifier of the balance account to which the chargeback fees are booked. By
     * default, the chargeback fees are booked to your liable balance account.
     *
     * @return costAllocationAccount The unique identifier of the balance account to which the
     *     chargeback fees are booked. By default, the chargeback fees are booked to your liable
     *     balance account.
     */
    @JsonProperty(JSON_PROPERTY_COST_ALLOCATION_ACCOUNT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getCostAllocationAccount() {
      return costAllocationAccount;
    }
  
    /**
     * The unique identifier of the balance account to which the chargeback fees are booked. By
     * default, the chargeback fees are booked to your liable balance account.
     *
     * @param costAllocationAccount The unique identifier of the balance account to which the
     *     chargeback fees are booked. By default, the chargeback fees are booked to your liable
     *     balance account.
     */
    @JsonProperty(JSON_PROPERTY_COST_ALLOCATION_ACCOUNT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCostAllocationAccount(String costAllocationAccount) {
      this.costAllocationAccount = costAllocationAccount;
    }
  
    /**
     * The unique identifier of the balance account against which the disputed amount is booked.
     * Required if &#x60;behavior&#x60; is **deductFromOneBalanceAccount**.
     *
     * @param targetAccount The unique identifier of the balance account against which the disputed
     *     amount is booked. Required if &#x60;behavior&#x60; is **deductFromOneBalanceAccount**.
     * @return the current {@code PlatformChargebackLogic} instance, allowing for method chaining
     */
    public PlatformChargebackLogic targetAccount(String targetAccount) {
      this.targetAccount = targetAccount;
      return this;
    }
  
    /**
     * The unique identifier of the balance account against which the disputed amount is booked.
     * Required if &#x60;behavior&#x60; is **deductFromOneBalanceAccount**.
     *
     * @return targetAccount The unique identifier of the balance account against which the disputed
     *     amount is booked. Required if &#x60;behavior&#x60; is **deductFromOneBalanceAccount**.
     */
    @JsonProperty(JSON_PROPERTY_TARGET_ACCOUNT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getTargetAccount() {
      return targetAccount;
    }
  
    /**
     * The unique identifier of the balance account against which the disputed amount is booked.
     * Required if &#x60;behavior&#x60; is **deductFromOneBalanceAccount**.
     *
     * @param targetAccount The unique identifier of the balance account against which the disputed
     *     amount is booked. Required if &#x60;behavior&#x60; is **deductFromOneBalanceAccount**.
     */
    @JsonProperty(JSON_PROPERTY_TARGET_ACCOUNT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setTargetAccount(String targetAccount) {
      this.targetAccount = targetAccount;
    }
  
    /** Return true if this PlatformChargebackLogic object is equal to o. */
    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      PlatformChargebackLogic platformChargebackLogic = (PlatformChargebackLogic) o;
      return Objects.equals(this.behavior, platformChargebackLogic.behavior)
          && Objects.equals(this.costAllocationAccount, platformChargebackLogic.costAllocationAccount)
          && Objects.equals(this.targetAccount, platformChargebackLogic.targetAccount);
    }
  
    @Override
    public int hashCode() {
      return Objects.hash(behavior, costAllocationAccount, targetAccount);
    }
  
    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("class PlatformChargebackLogic {\n");
      sb.append("    behavior: ").append(toIndentedString(behavior)).append("\n");
      sb.append("    costAllocationAccount: ")
          .append(toIndentedString(costAllocationAccount))
          .append("\n");
      sb.append("    targetAccount: ").append(toIndentedString(targetAccount)).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 PlatformChargebackLogic given an JSON string
     *
     * @param jsonString JSON string
     * @return An instance of PlatformChargebackLogic
     * @throws JsonProcessingException if the JSON string is invalid with respect to
     *     PlatformChargebackLogic
     */
    public static PlatformChargebackLogic fromJson(String jsonString) throws JsonProcessingException {
      return JSON.getMapper().readValue(jsonString, PlatformChargebackLogic.class);
    }
  
    /**
     * Convert an instance of PlatformChargebackLogic to an JSON string
     *
     * @return JSON string
     */
    public String toJson() throws JsonProcessingException {
      return JSON.getMapper().writeValueAsString(this);
    }
  }
  