/*
 * 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;

/**
 * V1Discount
 */

public class V1Discount {
  @JsonProperty("id")
  private String id = null;

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

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

  @JsonProperty("amount_money")
  private V1Money amountMoney = null;

  /**
   * Indicates whether the discount is a FIXED value or entered at the time of sale.
   */
  public enum DiscountTypeEnum {
    FIXED("FIXED"),
    
    VARIABLE_PERCENTAGE("VARIABLE_PERCENTAGE"),
    
    VARIABLE_AMOUNT("VARIABLE_AMOUNT");

    private String value;

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

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

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

  @JsonProperty("discount_type")
  private DiscountTypeEnum discountType = null;

  @JsonProperty("pin_required")
  private Boolean pinRequired = null;

  /**
   * The color of the discount's display label in Square Register, if not the default color. The default color is 9da2a6.
   */
  public enum ColorEnum {
    _9DA2A6("9da2a6"),
    
    _4AB200("4ab200"),
    
    _0B8000("0b8000"),
    
    _2952CC("2952cc"),
    
    A82EE5("a82ee5"),
    
    E5457A("e5457a"),
    
    B21212("b21212"),
    
    _593C00("593c00"),
    
    E5BF00("e5BF00");

    private String value;

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

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

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

  @JsonProperty("color")
  private ColorEnum color = null;

  public V1Discount id(String id) {
    this.id = id;
    return this;
  }

   /**
   * The discount's unique ID.
   * @return id
  **/
  @ApiModelProperty(value = "The discount's unique ID.")
  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public V1Discount name(String name) {
    this.name = name;
    return this;
  }

   /**
   * The discount's name.
   * @return name
  **/
  @ApiModelProperty(value = "The discount's name.")
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public V1Discount rate(String rate) {
    this.rate = rate;
    return this;
  }

   /**
   * The rate of the discount, as a string representation of a decimal number. A value of 0.07 corresponds to a rate of 7%. This rate is 0 if discount_type is VARIABLE_PERCENTAGE.
   * @return rate
  **/
  @ApiModelProperty(value = "The rate of the discount, as a string representation of a decimal number. A value of 0.07 corresponds to a rate of 7%. This rate is 0 if discount_type is VARIABLE_PERCENTAGE.")
  public String getRate() {
    return rate;
  }

  public void setRate(String rate) {
    this.rate = rate;
  }

  public V1Discount amountMoney(V1Money amountMoney) {
    this.amountMoney = amountMoney;
    return this;
  }

   /**
   * The amount of the discount. This amount is 0 if discount_type is VARIABLE_AMOUNT. This field is not included for rate-based discounts.
   * @return amountMoney
  **/
  @ApiModelProperty(value = "The amount of the discount. This amount is 0 if discount_type is VARIABLE_AMOUNT. This field is not included for rate-based discounts.")
  public V1Money getAmountMoney() {
    return amountMoney;
  }

  public void setAmountMoney(V1Money amountMoney) {
    this.amountMoney = amountMoney;
  }

  public V1Discount discountType(DiscountTypeEnum discountType) {
    this.discountType = discountType;
    return this;
  }

   /**
   * Indicates whether the discount is a FIXED value or entered at the time of sale.
   * @return discountType
  **/
  @ApiModelProperty(value = "Indicates whether the discount is a FIXED value or entered at the time of sale.")
  public DiscountTypeEnum getDiscountType() {
    return discountType;
  }

  public void setDiscountType(DiscountTypeEnum discountType) {
    this.discountType = discountType;
  }

  public V1Discount pinRequired(Boolean pinRequired) {
    this.pinRequired = pinRequired;
    return this;
  }

   /**
   * Indicates whether a mobile staff member needs to enter their PIN to apply the discount to a payment.
   * @return pinRequired
  **/
  @ApiModelProperty(value = "Indicates whether a mobile staff member needs to enter their PIN to apply the discount to a payment.")
  public Boolean getPinRequired() {
    return pinRequired;
  }

  public void setPinRequired(Boolean pinRequired) {
    this.pinRequired = pinRequired;
  }

  public V1Discount color(ColorEnum color) {
    this.color = color;
    return this;
  }

   /**
   * The color of the discount's display label in Square Register, if not the default color. The default color is 9da2a6.
   * @return color
  **/
  @ApiModelProperty(value = "The color of the discount's display label in Square Register, if not the default color. The default color is 9da2a6.")
  public ColorEnum getColor() {
    return color;
  }

  public void setColor(ColorEnum color) {
    this.color = color;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    V1Discount v1Discount = (V1Discount) o;
    return Objects.equals(this.id, v1Discount.id) &&
        Objects.equals(this.name, v1Discount.name) &&
        Objects.equals(this.rate, v1Discount.rate) &&
        Objects.equals(this.amountMoney, v1Discount.amountMoney) &&
        Objects.equals(this.discountType, v1Discount.discountType) &&
        Objects.equals(this.pinRequired, v1Discount.pinRequired) &&
        Objects.equals(this.color, v1Discount.color);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, name, rate, amountMoney, discountType, pinRequired, color);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class V1Discount {\n");
    
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    rate: ").append(toIndentedString(rate)).append("\n");
    sb.append("    amountMoney: ").append(toIndentedString(amountMoney)).append("\n");
    sb.append("    discountType: ").append(toIndentedString(discountType)).append("\n");
    sb.append("    pinRequired: ").append(toIndentedString(pinRequired)).append("\n");
    sb.append("    color: ").append(toIndentedString(color)).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    ");
  }
  
}