/*
 * Square Connect API
 * Client library for accessing the Square Connect APIs
 *
 * OpenAPI spec version: 2.0
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */


package com.squareup.connect.models;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.V1Money;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * V1CreateRefundRequest
 */

public class V1CreateRefundRequest {
  @JsonProperty("payment_id")
  private String paymentId = null;

  /**
   * TThe type of refund (FULL or PARTIAL).
   */
  public enum TypeEnum {
    FULL("FULL"),
    
    PARTIAL("PARTIAL");

    private String value;

    TypeEnum(String value) {
      this.value = value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static TypeEnum fromValue(String text) {
      for (TypeEnum b : TypeEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }
  }

  @JsonProperty("type")
  private TypeEnum type = null;

  @JsonProperty("reason")
  private String reason = null;

  @JsonProperty("refunded_money")
  private V1Money refundedMoney = null;

  @JsonProperty("request_idempotence_key")
  private String requestIdempotenceKey = null;

  public V1CreateRefundRequest paymentId(String paymentId) {
    this.paymentId = paymentId;
    return this;
  }

   /**
   * The ID of the payment to refund. If you're creating a PARTIAL refund for a split tender payment, instead provide the id of the particular tender you want to refund. See Split Tender Payments for details.
   * @return paymentId
  **/
  @ApiModelProperty(required = true, value = "The ID of the payment to refund. If you're creating a PARTIAL refund for a split tender payment, instead provide the id of the particular tender you want to refund. See Split Tender Payments for details.")
  public String getPaymentId() {
    return paymentId;
  }

  public void setPaymentId(String paymentId) {
    this.paymentId = paymentId;
  }

  public V1CreateRefundRequest type(TypeEnum type) {
    this.type = type;
    return this;
  }

   /**
   * TThe type of refund (FULL or PARTIAL).
   * @return type
  **/
  @ApiModelProperty(required = true, value = "TThe type of refund (FULL or PARTIAL).")
  public TypeEnum getType() {
    return type;
  }

  public void setType(TypeEnum type) {
    this.type = type;
  }

  public V1CreateRefundRequest reason(String reason) {
    this.reason = reason;
    return this;
  }

   /**
   * The reason for the refund.
   * @return reason
  **/
  @ApiModelProperty(required = true, value = "The reason for the refund.")
  public String getReason() {
    return reason;
  }

  public void setReason(String reason) {
    this.reason = reason;
  }

  public V1CreateRefundRequest refundedMoney(V1Money refundedMoney) {
    this.refundedMoney = refundedMoney;
    return this;
  }

   /**
   * The amount of money to refund. Required only for PARTIAL refunds.
   * @return refundedMoney
  **/
  @ApiModelProperty(value = "The amount of money to refund. Required only for PARTIAL refunds.")
  public V1Money getRefundedMoney() {
    return refundedMoney;
  }

  public void setRefundedMoney(V1Money refundedMoney) {
    this.refundedMoney = refundedMoney;
  }

  public V1CreateRefundRequest requestIdempotenceKey(String requestIdempotenceKey) {
    this.requestIdempotenceKey = requestIdempotenceKey;
    return this;
  }

   /**
   * An optional key to ensure idempotence if you issue the same PARTIAL refund request more than once.
   * @return requestIdempotenceKey
  **/
  @ApiModelProperty(value = "An optional key to ensure idempotence if you issue the same PARTIAL refund request more than once.")
  public String getRequestIdempotenceKey() {
    return requestIdempotenceKey;
  }

  public void setRequestIdempotenceKey(String requestIdempotenceKey) {
    this.requestIdempotenceKey = requestIdempotenceKey;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    V1CreateRefundRequest v1CreateRefundRequest = (V1CreateRefundRequest) o;
    return Objects.equals(this.paymentId, v1CreateRefundRequest.paymentId) &&
        Objects.equals(this.type, v1CreateRefundRequest.type) &&
        Objects.equals(this.reason, v1CreateRefundRequest.reason) &&
        Objects.equals(this.refundedMoney, v1CreateRefundRequest.refundedMoney) &&
        Objects.equals(this.requestIdempotenceKey, v1CreateRefundRequest.requestIdempotenceKey);
  }

  @Override
  public int hashCode() {
    return Objects.hash(paymentId, type, reason, refundedMoney, requestIdempotenceKey);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class V1CreateRefundRequest {\n");
    
    sb.append("    paymentId: ").append(toIndentedString(paymentId)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    reason: ").append(toIndentedString(reason)).append("\n");
    sb.append("    refundedMoney: ").append(toIndentedString(refundedMoney)).append("\n");
    sb.append("    requestIdempotenceKey: ").append(toIndentedString(requestIdempotenceKey)).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(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
  
}