/*
 * 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 java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.CalendarDateIntervalDto;
import org.openapitools.client.model.CalendarHolidayDto;
import org.openapitools.client.model.DayInYearDto;
import org.openapitools.client.model.HourInDayDto;
import org.threeten.bp.OffsetDateTime;

/**
 * CalendarDto
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-09-13T10:03:17.753Z[GMT]")
public class CalendarDto {
  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;

  /**
   * Gets or Sets calendarType
   */
  @JsonAdapter(CalendarTypeEnum.Adapter.class)
  public enum CalendarTypeEnum {
    YEARLY("YEARLY"),
    
    DAILY("DAILY"),
    
    PERIOD("PERIOD"),
    
    INTERVAL("INTERVAL"),
    
    INTERSECT("INTERSECT"),
    
    UNION("UNION"),
    
    BANKING("BANKING");

    private String value;

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

    public String getValue() {
      return value;
    }

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

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

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

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

  public static final String SERIALIZED_NAME_CALENDAR_TYPE = "calendarType";
  @SerializedName(SERIALIZED_NAME_CALENDAR_TYPE)
  private CalendarTypeEnum calendarType;

  public static final String SERIALIZED_NAME_DAYS = "days";
  @SerializedName(SERIALIZED_NAME_DAYS)
  private List<DayInYearDto> days = null;

  public static final String SERIALIZED_NAME_HOURS = "hours";
  @SerializedName(SERIALIZED_NAME_HOURS)
  private List<HourInDayDto> hours = null;

  public static final String SERIALIZED_NAME_PERIOD_LENGTH = "periodLength";
  @SerializedName(SERIALIZED_NAME_PERIOD_LENGTH)
  private Integer periodLength;

  /**
   * Gets or Sets periodUnit
   */
  @JsonAdapter(PeriodUnitEnum.Adapter.class)
  public enum PeriodUnitEnum {
    MONTH("MONTH"),
    
    DAY_OF_MONTH("DAY_OF_MONTH"),
    
    HOUR_OF_DAY("HOUR_OF_DAY"),
    
    MINUTE("MINUTE"),
    
    SECOND("SECOND");

    private String value;

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

    public String getValue() {
      return value;
    }

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

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

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

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

  public static final String SERIALIZED_NAME_PERIOD_UNIT = "periodUnit";
  @SerializedName(SERIALIZED_NAME_PERIOD_UNIT)
  private PeriodUnitEnum periodUnit;

  public static final String SERIALIZED_NAME_NB_PERIODS = "nbPeriods";
  @SerializedName(SERIALIZED_NAME_NB_PERIODS)
  private Integer nbPeriods;

  public static final String SERIALIZED_NAME_JOIN_CALENDAR1_CODE = "joinCalendar1Code";
  @SerializedName(SERIALIZED_NAME_JOIN_CALENDAR1_CODE)
  private String joinCalendar1Code;

  public static final String SERIALIZED_NAME_JOIN_CALENDAR2_CODE = "joinCalendar2Code";
  @SerializedName(SERIALIZED_NAME_JOIN_CALENDAR2_CODE)
  private String joinCalendar2Code;

  /**
   * Gets or Sets intervalType
   */
  @JsonAdapter(IntervalTypeEnum.Adapter.class)
  public enum IntervalTypeEnum {
    DAY("DAY"),
    
    HOUR("HOUR"),
    
    WDAY("WDAY");

    private String value;

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

    public String getValue() {
      return value;
    }

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

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

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

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

  public static final String SERIALIZED_NAME_INTERVAL_TYPE = "intervalType";
  @SerializedName(SERIALIZED_NAME_INTERVAL_TYPE)
  private IntervalTypeEnum intervalType;

  public static final String SERIALIZED_NAME_INTERVALS = "intervals";
  @SerializedName(SERIALIZED_NAME_INTERVALS)
  private List<CalendarDateIntervalDto> intervals = null;

  public static final String SERIALIZED_NAME_WEEKEND_BEGIN = "weekendBegin";
  @SerializedName(SERIALIZED_NAME_WEEKEND_BEGIN)
  private Integer weekendBegin;

  public static final String SERIALIZED_NAME_WEEKEND_END = "weekendEnd";
  @SerializedName(SERIALIZED_NAME_WEEKEND_END)
  private Integer weekendEnd;

  public static final String SERIALIZED_NAME_END_DATE = "endDate";
  @SerializedName(SERIALIZED_NAME_END_DATE)
  private OffsetDateTime endDate;

  public static final String SERIALIZED_NAME_START_DATE = "startDate";
  @SerializedName(SERIALIZED_NAME_START_DATE)
  private OffsetDateTime startDate;

  public static final String SERIALIZED_NAME_HOLIDAYS = "holidays";
  @SerializedName(SERIALIZED_NAME_HOLIDAYS)
  private List<CalendarHolidayDto> holidays = null;


  public CalendarDto 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 CalendarDto 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 CalendarDto 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 CalendarDto 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 CalendarDto calendarType(CalendarTypeEnum calendarType) {
    
    this.calendarType = calendarType;
    return this;
  }

   /**
   * Get calendarType
   * @return calendarType
  **/
  @ApiModelProperty(required = true, value = "")

  public CalendarTypeEnum getCalendarType() {
    return calendarType;
  }



  public void setCalendarType(CalendarTypeEnum calendarType) {
    this.calendarType = calendarType;
  }


  public CalendarDto days(List<DayInYearDto> days) {
    
    this.days = days;
    return this;
  }

  public CalendarDto addDaysItem(DayInYearDto daysItem) {
    if (this.days == null) {
      this.days = new ArrayList<DayInYearDto>();
    }
    this.days.add(daysItem);
    return this;
  }

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

  public List<DayInYearDto> getDays() {
    return days;
  }



  public void setDays(List<DayInYearDto> days) {
    this.days = days;
  }


  public CalendarDto hours(List<HourInDayDto> hours) {
    
    this.hours = hours;
    return this;
  }

  public CalendarDto addHoursItem(HourInDayDto hoursItem) {
    if (this.hours == null) {
      this.hours = new ArrayList<HourInDayDto>();
    }
    this.hours.add(hoursItem);
    return this;
  }

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

  public List<HourInDayDto> getHours() {
    return hours;
  }



  public void setHours(List<HourInDayDto> hours) {
    this.hours = hours;
  }


  public CalendarDto periodLength(Integer periodLength) {
    
    this.periodLength = periodLength;
    return this;
  }

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

  public Integer getPeriodLength() {
    return periodLength;
  }



  public void setPeriodLength(Integer periodLength) {
    this.periodLength = periodLength;
  }


  public CalendarDto periodUnit(PeriodUnitEnum periodUnit) {
    
    this.periodUnit = periodUnit;
    return this;
  }

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

  public PeriodUnitEnum getPeriodUnit() {
    return periodUnit;
  }



  public void setPeriodUnit(PeriodUnitEnum periodUnit) {
    this.periodUnit = periodUnit;
  }


  public CalendarDto nbPeriods(Integer nbPeriods) {
    
    this.nbPeriods = nbPeriods;
    return this;
  }

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

  public Integer getNbPeriods() {
    return nbPeriods;
  }



  public void setNbPeriods(Integer nbPeriods) {
    this.nbPeriods = nbPeriods;
  }


  public CalendarDto joinCalendar1Code(String joinCalendar1Code) {
    
    this.joinCalendar1Code = joinCalendar1Code;
    return this;
  }

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

  public String getJoinCalendar1Code() {
    return joinCalendar1Code;
  }



  public void setJoinCalendar1Code(String joinCalendar1Code) {
    this.joinCalendar1Code = joinCalendar1Code;
  }


  public CalendarDto joinCalendar2Code(String joinCalendar2Code) {
    
    this.joinCalendar2Code = joinCalendar2Code;
    return this;
  }

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

  public String getJoinCalendar2Code() {
    return joinCalendar2Code;
  }



  public void setJoinCalendar2Code(String joinCalendar2Code) {
    this.joinCalendar2Code = joinCalendar2Code;
  }


  public CalendarDto intervalType(IntervalTypeEnum intervalType) {
    
    this.intervalType = intervalType;
    return this;
  }

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

  public IntervalTypeEnum getIntervalType() {
    return intervalType;
  }



  public void setIntervalType(IntervalTypeEnum intervalType) {
    this.intervalType = intervalType;
  }


  public CalendarDto intervals(List<CalendarDateIntervalDto> intervals) {
    
    this.intervals = intervals;
    return this;
  }

  public CalendarDto addIntervalsItem(CalendarDateIntervalDto intervalsItem) {
    if (this.intervals == null) {
      this.intervals = new ArrayList<CalendarDateIntervalDto>();
    }
    this.intervals.add(intervalsItem);
    return this;
  }

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

  public List<CalendarDateIntervalDto> getIntervals() {
    return intervals;
  }



  public void setIntervals(List<CalendarDateIntervalDto> intervals) {
    this.intervals = intervals;
  }


  public CalendarDto weekendBegin(Integer weekendBegin) {
    
    this.weekendBegin = weekendBegin;
    return this;
  }

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

  public Integer getWeekendBegin() {
    return weekendBegin;
  }



  public void setWeekendBegin(Integer weekendBegin) {
    this.weekendBegin = weekendBegin;
  }


  public CalendarDto weekendEnd(Integer weekendEnd) {
    
    this.weekendEnd = weekendEnd;
    return this;
  }

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

  public Integer getWeekendEnd() {
    return weekendEnd;
  }



  public void setWeekendEnd(Integer weekendEnd) {
    this.weekendEnd = weekendEnd;
  }


  public CalendarDto endDate(OffsetDateTime endDate) {
    
    this.endDate = endDate;
    return this;
  }

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

  public OffsetDateTime getEndDate() {
    return endDate;
  }



  public void setEndDate(OffsetDateTime endDate) {
    this.endDate = endDate;
  }


  public CalendarDto startDate(OffsetDateTime startDate) {
    
    this.startDate = startDate;
    return this;
  }

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

  public OffsetDateTime getStartDate() {
    return startDate;
  }



  public void setStartDate(OffsetDateTime startDate) {
    this.startDate = startDate;
  }


  public CalendarDto holidays(List<CalendarHolidayDto> holidays) {
    
    this.holidays = holidays;
    return this;
  }

  public CalendarDto addHolidaysItem(CalendarHolidayDto holidaysItem) {
    if (this.holidays == null) {
      this.holidays = new ArrayList<CalendarHolidayDto>();
    }
    this.holidays.add(holidaysItem);
    return this;
  }

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

  public List<CalendarHolidayDto> getHolidays() {
    return holidays;
  }



  public void setHolidays(List<CalendarHolidayDto> holidays) {
    this.holidays = holidays;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    CalendarDto calendarDto = (CalendarDto) o;
    return Objects.equals(this.id, calendarDto.id) &&
        Objects.equals(this.code, calendarDto.code) &&
        Objects.equals(this.description, calendarDto.description) &&
        Objects.equals(this.updatedCode, calendarDto.updatedCode) &&
        Objects.equals(this.calendarType, calendarDto.calendarType) &&
        Objects.equals(this.days, calendarDto.days) &&
        Objects.equals(this.hours, calendarDto.hours) &&
        Objects.equals(this.periodLength, calendarDto.periodLength) &&
        Objects.equals(this.periodUnit, calendarDto.periodUnit) &&
        Objects.equals(this.nbPeriods, calendarDto.nbPeriods) &&
        Objects.equals(this.joinCalendar1Code, calendarDto.joinCalendar1Code) &&
        Objects.equals(this.joinCalendar2Code, calendarDto.joinCalendar2Code) &&
        Objects.equals(this.intervalType, calendarDto.intervalType) &&
        Objects.equals(this.intervals, calendarDto.intervals) &&
        Objects.equals(this.weekendBegin, calendarDto.weekendBegin) &&
        Objects.equals(this.weekendEnd, calendarDto.weekendEnd) &&
        Objects.equals(this.endDate, calendarDto.endDate) &&
        Objects.equals(this.startDate, calendarDto.startDate) &&
        Objects.equals(this.holidays, calendarDto.holidays);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, code, description, updatedCode, calendarType, days, hours, periodLength, periodUnit, nbPeriods, joinCalendar1Code, joinCalendar2Code, intervalType, intervals, weekendBegin, weekendEnd, endDate, startDate, holidays);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class CalendarDto {\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("    calendarType: ").append(toIndentedString(calendarType)).append("\n");
    sb.append("    days: ").append(toIndentedString(days)).append("\n");
    sb.append("    hours: ").append(toIndentedString(hours)).append("\n");
    sb.append("    periodLength: ").append(toIndentedString(periodLength)).append("\n");
    sb.append("    periodUnit: ").append(toIndentedString(periodUnit)).append("\n");
    sb.append("    nbPeriods: ").append(toIndentedString(nbPeriods)).append("\n");
    sb.append("    joinCalendar1Code: ").append(toIndentedString(joinCalendar1Code)).append("\n");
    sb.append("    joinCalendar2Code: ").append(toIndentedString(joinCalendar2Code)).append("\n");
    sb.append("    intervalType: ").append(toIndentedString(intervalType)).append("\n");
    sb.append("    intervals: ").append(toIndentedString(intervals)).append("\n");
    sb.append("    weekendBegin: ").append(toIndentedString(weekendBegin)).append("\n");
    sb.append("    weekendEnd: ").append(toIndentedString(weekendEnd)).append("\n");
    sb.append("    endDate: ").append(toIndentedString(endDate)).append("\n");
    sb.append("    startDate: ").append(toIndentedString(startDate)).append("\n");
    sb.append("    holidays: ").append(toIndentedString(holidays)).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    ");
  }

}

