/*
 * Swagger of Opencellsoft Api
 * @#Introduction
 *
 * The version of the OpenAPI document: 7.3.1-SNAPSHOT
 * Contact: contact@opencellsoft.fr
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import org.openapitools.client.model.ScriptInstanceDto;

/**
 * RevenueRecognitionRuleDto
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-09-13T10:03:17.753Z[GMT]")
public class RevenueRecognitionRuleDto {
  public static final String SERIALIZED_NAME_ID = "id";
  @SerializedName(SERIALIZED_NAME_ID)
  private Long id;

  public static final String SERIALIZED_NAME_CODE = "code";
  @SerializedName(SERIALIZED_NAME_CODE)
  private String code;

  public static final String SERIALIZED_NAME_DESCRIPTION = "description";
  @SerializedName(SERIALIZED_NAME_DESCRIPTION)
  private String description;

  public static final String SERIALIZED_NAME_UPDATED_CODE = "updatedCode";
  @SerializedName(SERIALIZED_NAME_UPDATED_CODE)
  private String updatedCode;

  public static final String SERIALIZED_NAME_DISABLED = "disabled";
  @SerializedName(SERIALIZED_NAME_DISABLED)
  private Boolean disabled;

  public static final String SERIALIZED_NAME_START_DELAY = "startDelay";
  @SerializedName(SERIALIZED_NAME_START_DELAY)
  private Integer startDelay;

  /**
   * Gets or Sets startUnit
   */
  @JsonAdapter(StartUnitEnum.Adapter.class)
  public enum StartUnitEnum {
    MONTH("revenueRecognitionDelayUnitEnum.MONTH"),
    
    DAY("revenueRecognitionDelayUnitEnum.DAY");

    private String value;

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

    public String getValue() {
      return value;
    }

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

    public static StartUnitEnum fromValue(String value) {
      for (StartUnitEnum b : StartUnitEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter<StartUnitEnum> {
      @Override
      public void write(final JsonWriter jsonWriter, final StartUnitEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public StartUnitEnum read(final JsonReader jsonReader) throws IOException {
        String value = jsonReader.nextString();
        return StartUnitEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_START_UNIT = "startUnit";
  @SerializedName(SERIALIZED_NAME_START_UNIT)
  private StartUnitEnum startUnit;

  /**
   * Gets or Sets startEvent
   */
  @JsonAdapter(StartEventEnum.Adapter.class)
  public enum StartEventEnum {
    SUBSCRIPTION_START("revenueRecognitionEvent.SUBSCRIPTION_START"),
    
    SUBSCRIPTION_STOP("revenueRecognitionEvent.SUBSCRIPTION_STOP"),
    
    INVOICE_DATE("revenueRecognitionEvent.INVOICE_DATE"),
    
    INVOICE_DUE_DATE("revenueRecognitionEvent.INVOICE_DUE_DATE"),
    
    SERVICE_PERIOD_START("revenueRecognitionEvent.SERVICE_PERIOD_START"),
    
    SERVICE_PERIOD_STOP("revenueRecognitionEvent.SERVICE_PERIOD_STOP");

    private String value;

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

    public String getValue() {
      return value;
    }

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

    public static StartEventEnum fromValue(String value) {
      for (StartEventEnum b : StartEventEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter<StartEventEnum> {
      @Override
      public void write(final JsonWriter jsonWriter, final StartEventEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public StartEventEnum read(final JsonReader jsonReader) throws IOException {
        String value = jsonReader.nextString();
        return StartEventEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_START_EVENT = "startEvent";
  @SerializedName(SERIALIZED_NAME_START_EVENT)
  private StartEventEnum startEvent;

  public static final String SERIALIZED_NAME_STOP_DELAY = "stopDelay";
  @SerializedName(SERIALIZED_NAME_STOP_DELAY)
  private Integer stopDelay;

  /**
   * Gets or Sets stopUnit
   */
  @JsonAdapter(StopUnitEnum.Adapter.class)
  public enum StopUnitEnum {
    MONTH("revenueRecognitionDelayUnitEnum.MONTH"),
    
    DAY("revenueRecognitionDelayUnitEnum.DAY");

    private String value;

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

    public String getValue() {
      return value;
    }

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

    public static StopUnitEnum fromValue(String value) {
      for (StopUnitEnum b : StopUnitEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter<StopUnitEnum> {
      @Override
      public void write(final JsonWriter jsonWriter, final StopUnitEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public StopUnitEnum read(final JsonReader jsonReader) throws IOException {
        String value = jsonReader.nextString();
        return StopUnitEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_STOP_UNIT = "stopUnit";
  @SerializedName(SERIALIZED_NAME_STOP_UNIT)
  private StopUnitEnum stopUnit;

  /**
   * Gets or Sets stopEvent
   */
  @JsonAdapter(StopEventEnum.Adapter.class)
  public enum StopEventEnum {
    SUBSCRIPTION_START("revenueRecognitionEvent.SUBSCRIPTION_START"),
    
    SUBSCRIPTION_STOP("revenueRecognitionEvent.SUBSCRIPTION_STOP"),
    
    INVOICE_DATE("revenueRecognitionEvent.INVOICE_DATE"),
    
    INVOICE_DUE_DATE("revenueRecognitionEvent.INVOICE_DUE_DATE"),
    
    SERVICE_PERIOD_START("revenueRecognitionEvent.SERVICE_PERIOD_START"),
    
    SERVICE_PERIOD_STOP("revenueRecognitionEvent.SERVICE_PERIOD_STOP");

    private String value;

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

    public String getValue() {
      return value;
    }

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

    public static StopEventEnum fromValue(String value) {
      for (StopEventEnum b : StopEventEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter<StopEventEnum> {
      @Override
      public void write(final JsonWriter jsonWriter, final StopEventEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public StopEventEnum read(final JsonReader jsonReader) throws IOException {
        String value = jsonReader.nextString();
        return StopEventEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_STOP_EVENT = "stopEvent";
  @SerializedName(SERIALIZED_NAME_STOP_EVENT)
  private StopEventEnum stopEvent;

  public static final String SERIALIZED_NAME_SCRIPT = "script";
  @SerializedName(SERIALIZED_NAME_SCRIPT)
  private ScriptInstanceDto script;


  public RevenueRecognitionRuleDto id(Long id) {
    
    this.id = id;
    return this;
  }

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

  public Long getId() {
    return id;
  }



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


  public RevenueRecognitionRuleDto code(String code) {
    
    this.code = code;
    return this;
  }

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

  public String getCode() {
    return code;
  }



  public void setCode(String code) {
    this.code = code;
  }


  public RevenueRecognitionRuleDto description(String description) {
    
    this.description = description;
    return this;
  }

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

  public String getDescription() {
    return description;
  }



  public void setDescription(String description) {
    this.description = description;
  }


  public RevenueRecognitionRuleDto updatedCode(String updatedCode) {
    
    this.updatedCode = updatedCode;
    return this;
  }

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

  public String getUpdatedCode() {
    return updatedCode;
  }



  public void setUpdatedCode(String updatedCode) {
    this.updatedCode = updatedCode;
  }


  public RevenueRecognitionRuleDto disabled(Boolean disabled) {
    
    this.disabled = disabled;
    return this;
  }

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

  public Boolean getDisabled() {
    return disabled;
  }



  public void setDisabled(Boolean disabled) {
    this.disabled = disabled;
  }


  public RevenueRecognitionRuleDto startDelay(Integer startDelay) {
    
    this.startDelay = startDelay;
    return this;
  }

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

  public Integer getStartDelay() {
    return startDelay;
  }



  public void setStartDelay(Integer startDelay) {
    this.startDelay = startDelay;
  }


  public RevenueRecognitionRuleDto startUnit(StartUnitEnum startUnit) {
    
    this.startUnit = startUnit;
    return this;
  }

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

  public StartUnitEnum getStartUnit() {
    return startUnit;
  }



  public void setStartUnit(StartUnitEnum startUnit) {
    this.startUnit = startUnit;
  }


  public RevenueRecognitionRuleDto startEvent(StartEventEnum startEvent) {
    
    this.startEvent = startEvent;
    return this;
  }

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

  public StartEventEnum getStartEvent() {
    return startEvent;
  }



  public void setStartEvent(StartEventEnum startEvent) {
    this.startEvent = startEvent;
  }


  public RevenueRecognitionRuleDto stopDelay(Integer stopDelay) {
    
    this.stopDelay = stopDelay;
    return this;
  }

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

  public Integer getStopDelay() {
    return stopDelay;
  }



  public void setStopDelay(Integer stopDelay) {
    this.stopDelay = stopDelay;
  }


  public RevenueRecognitionRuleDto stopUnit(StopUnitEnum stopUnit) {
    
    this.stopUnit = stopUnit;
    return this;
  }

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

  public StopUnitEnum getStopUnit() {
    return stopUnit;
  }



  public void setStopUnit(StopUnitEnum stopUnit) {
    this.stopUnit = stopUnit;
  }


  public RevenueRecognitionRuleDto stopEvent(StopEventEnum stopEvent) {
    
    this.stopEvent = stopEvent;
    return this;
  }

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

  public StopEventEnum getStopEvent() {
    return stopEvent;
  }



  public void setStopEvent(StopEventEnum stopEvent) {
    this.stopEvent = stopEvent;
  }


  public RevenueRecognitionRuleDto script(ScriptInstanceDto script) {
    
    this.script = script;
    return this;
  }

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

  public ScriptInstanceDto getScript() {
    return script;
  }



  public void setScript(ScriptInstanceDto script) {
    this.script = script;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    RevenueRecognitionRuleDto revenueRecognitionRuleDto = (RevenueRecognitionRuleDto) o;
    return Objects.equals(this.id, revenueRecognitionRuleDto.id) &&
        Objects.equals(this.code, revenueRecognitionRuleDto.code) &&
        Objects.equals(this.description, revenueRecognitionRuleDto.description) &&
        Objects.equals(this.updatedCode, revenueRecognitionRuleDto.updatedCode) &&
        Objects.equals(this.disabled, revenueRecognitionRuleDto.disabled) &&
        Objects.equals(this.startDelay, revenueRecognitionRuleDto.startDelay) &&
        Objects.equals(this.startUnit, revenueRecognitionRuleDto.startUnit) &&
        Objects.equals(this.startEvent, revenueRecognitionRuleDto.startEvent) &&
        Objects.equals(this.stopDelay, revenueRecognitionRuleDto.stopDelay) &&
        Objects.equals(this.stopUnit, revenueRecognitionRuleDto.stopUnit) &&
        Objects.equals(this.stopEvent, revenueRecognitionRuleDto.stopEvent) &&
        Objects.equals(this.script, revenueRecognitionRuleDto.script);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, code, description, updatedCode, disabled, startDelay, startUnit, startEvent, stopDelay, stopUnit, stopEvent, script);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class RevenueRecognitionRuleDto {\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    code: ").append(toIndentedString(code)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    updatedCode: ").append(toIndentedString(updatedCode)).append("\n");
    sb.append("    disabled: ").append(toIndentedString(disabled)).append("\n");
    sb.append("    startDelay: ").append(toIndentedString(startDelay)).append("\n");
    sb.append("    startUnit: ").append(toIndentedString(startUnit)).append("\n");
    sb.append("    startEvent: ").append(toIndentedString(startEvent)).append("\n");
    sb.append("    stopDelay: ").append(toIndentedString(stopDelay)).append("\n");
    sb.append("    stopUnit: ").append(toIndentedString(stopUnit)).append("\n");
    sb.append("    stopEvent: ").append(toIndentedString(stopEvent)).append("\n");
    sb.append("    script: ").append(toIndentedString(script)).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    ");
  }

}

