package com.oguerreiro.resilient.service.criteria;

import java.util.Objects;
import java.util.Optional;

import org.springdoc.core.annotations.ParameterObject;

import tech.jhipster.service.filter.BigDecimalFilter;
import tech.jhipster.service.filter.Filter;
import tech.jhipster.service.filter.InstantFilter;
import tech.jhipster.service.filter.IntegerFilter;
import tech.jhipster.service.filter.LocalDateFilter;
import tech.jhipster.service.filter.LongFilter;
import tech.jhipster.service.filter.StringFilter;

/**
 * Criteria class for the {@link com.oguerreiro.resilient.domain.InputData}
 * entity. This class is used in
 * {@link com.oguerreiro.resilient.web.rest.InputDataResource} to receive all
 * the possible filtering options from the Http GET request parameters. For
 * example the following could be a valid request:
 * {@code /input-data?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
 * As Spring is unable to properly convert the types, unless specific
 * {@link Filter} class are used, we need to use fix type specific filters.
 */
@ParameterObject
public class InputDataCriteria extends AbstractCriteria {
  private static final long serialVersionUID = 1L;

  private LongFilter id;

  private BigDecimalFilter sourceValue;

  private BigDecimalFilter variableValue;

  private BigDecimalFilter imputedValue;

  private DataSourceTypeFilter sourceType;

  private LocalDateFilter dataDate;

  private InstantFilter changeDate;

  private StringFilter changeUsername;

  private StringFilter dataSource;

  private StringFilter dataUser;

  private StringFilter dataComments;

  private InstantFilter creationDate;

  private StringFilter creationUsername;

  private IntegerFilter version;

  private LongFilter inputDataId;

  private LongFilter variableId;

  private StringFilter variableNameOrCode;

  private StringFilter variableClassNameOrCode;

  private LongFilter periodId;

  private LongFilter sourceUnitId;

  private LongFilter unitId;

  private LongFilter ownerId;

  private LongFilter sourceInputDataId;

  private LongFilter sourceInputDataUploadId;

  //TODO: Change this to variableScopeId. No sense in changing the real domain name (VariableScope)
  @Deprecated
  private LongFilter scopeId;
  //TODO: Change this to variableCategoryId. No sense in changing the real domain name (VariableCategory)
  @Deprecated
  private LongFilter categoryId;
  private LongFilter variableScopeId;
  private LongFilter variableCategoryId;

  public InputDataCriteria() {
  }

  public InputDataCriteria(InputDataCriteria other) {
    super(other);

    this.id = other.optionalId().map(LongFilter::copy).orElse(null);
    this.sourceValue = other.optionalSourceValue().map(BigDecimalFilter::copy).orElse(null);
    this.variableValue = other.optionalVariableValue().map(BigDecimalFilter::copy).orElse(null);
    this.imputedValue = other.optionalImputedValue().map(BigDecimalFilter::copy).orElse(null);
    this.sourceType = other.optionalSourceType().map(DataSourceTypeFilter::copy).orElse(null);
    this.dataDate = other.optionalDataDate().map(LocalDateFilter::copy).orElse(null);
    this.changeDate = other.optionalChangeDate().map(InstantFilter::copy).orElse(null);
    this.changeUsername = other.optionalChangeUsername().map(StringFilter::copy).orElse(null);
    this.dataSource = other.optionalDataSource().map(StringFilter::copy).orElse(null);
    this.dataUser = other.optionalDataUser().map(StringFilter::copy).orElse(null);
    this.dataComments = other.optionalDataComments().map(StringFilter::copy).orElse(null);
    this.creationDate = other.optionalCreationDate().map(InstantFilter::copy).orElse(null);
    this.creationUsername = other.optionalCreationUsername().map(StringFilter::copy).orElse(null);
    this.version = other.optionalVersion().map(IntegerFilter::copy).orElse(null);
    this.inputDataId = other.optionalInputDataId().map(LongFilter::copy).orElse(null);
    this.variableId = other.optionalVariableId().map(LongFilter::copy).orElse(null);
    this.variableNameOrCode = other.optionalVariableNameOrCode().map(StringFilter::copy).orElse(null);
    this.variableClassNameOrCode = other.optionalVariableClassNameOrCode().map(StringFilter::copy).orElse(null);
    this.periodId = other.optionalPeriodId().map(LongFilter::copy).orElse(null);
    this.sourceUnitId = other.optionalSourceUnitId().map(LongFilter::copy).orElse(null);
    this.unitId = other.optionalUnitId().map(LongFilter::copy).orElse(null);
    this.ownerId = other.optionalOwnerId().map(LongFilter::copy).orElse(null);
    this.sourceInputDataId = other.optionalSourceInputDataId().map(LongFilter::copy).orElse(null);
    this.sourceInputDataUploadId = other.optionalSourceInputDataUploadId().map(LongFilter::copy).orElse(null);

    this.scopeId = other.optionalScopeId().map(LongFilter::copy).orElse(null);
    this.categoryId = other.optionalCategoryId().map(LongFilter::copy).orElse(null);
    this.variableScopeId = other.optionalVariableScopeId().map(LongFilter::copy).orElse(null);
    this.variableCategoryId = other.optionalVariableCategoryId().map(LongFilter::copy).orElse(null);
  }

  @Override
  public InputDataCriteria copy() {
    return new InputDataCriteria(this);
  }

  public LongFilter getId() {
    return id;
  }

  public Optional<LongFilter> optionalId() {
    return Optional.ofNullable(id);
  }

  public LongFilter id() {
    if (id == null) {
      setId(new LongFilter());
    }
    return id;
  }

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

  public BigDecimalFilter getSourceValue() {
    return sourceValue;
  }

  public Optional<BigDecimalFilter> optionalSourceValue() {
    return Optional.ofNullable(sourceValue);
  }

  public BigDecimalFilter sourceValue() {
    if (sourceValue == null) {
      setSourceValue(new BigDecimalFilter());
    }
    return sourceValue;
  }

  public void setSourceValue(BigDecimalFilter sourceValue) {
    this.sourceValue = sourceValue;
  }

  public BigDecimalFilter getVariableValue() {
    return variableValue;
  }

  public Optional<BigDecimalFilter> optionalVariableValue() {
    return Optional.ofNullable(variableValue);
  }

  public BigDecimalFilter variableValue() {
    if (variableValue == null) {
      setVariableValue(new BigDecimalFilter());
    }
    return variableValue;
  }

  public void setVariableValue(BigDecimalFilter variableValue) {
    this.variableValue = variableValue;
  }

  public BigDecimalFilter getImputedValue() {
    return imputedValue;
  }

  public Optional<BigDecimalFilter> optionalImputedValue() {
    return Optional.ofNullable(imputedValue);
  }

  public BigDecimalFilter imputedValue() {
    if (imputedValue == null) {
      setImputedValue(new BigDecimalFilter());
    }
    return imputedValue;
  }

  public void setImputedValue(BigDecimalFilter imputedValue) {
    this.imputedValue = imputedValue;
  }

  public DataSourceTypeFilter getSourceType() {
    return sourceType;
  }

  public Optional<DataSourceTypeFilter> optionalSourceType() {
    return Optional.ofNullable(sourceType);
  }

  public DataSourceTypeFilter sourceType() {
    if (sourceType == null) {
      setSourceType(new DataSourceTypeFilter());
    }
    return sourceType;
  }

  public void setSourceType(DataSourceTypeFilter sourceType) {
    this.sourceType = sourceType;
  }

  public LocalDateFilter getDataDate() {
    return dataDate;
  }

  public Optional<LocalDateFilter> optionalDataDate() {
    return Optional.ofNullable(dataDate);
  }

  public LocalDateFilter dataDate() {
    if (dataDate == null) {
      setDataDate(new LocalDateFilter());
    }
    return dataDate;
  }

  public void setDataDate(LocalDateFilter dataDate) {
    this.dataDate = dataDate;
  }

  public InstantFilter getChangeDate() {
    return changeDate;
  }

  public Optional<InstantFilter> optionalChangeDate() {
    return Optional.ofNullable(changeDate);
  }

  public InstantFilter changeDate() {
    if (changeDate == null) {
      setChangeDate(new InstantFilter());
    }
    return changeDate;
  }

  public void setChangeDate(InstantFilter changeDate) {
    this.changeDate = changeDate;
  }

  public StringFilter getChangeUsername() {
    return changeUsername;
  }

  public Optional<StringFilter> optionalChangeUsername() {
    return Optional.ofNullable(changeUsername);
  }

  public StringFilter changeUsername() {
    if (changeUsername == null) {
      setChangeUsername(new StringFilter());
    }
    return changeUsername;
  }

  public void setChangeUsername(StringFilter changeUsername) {
    this.changeUsername = changeUsername;
  }

  public StringFilter getDataSource() {
    return dataSource;
  }

  public Optional<StringFilter> optionalDataSource() {
    return Optional.ofNullable(dataSource);
  }

  public StringFilter dataSource() {
    if (dataSource == null) {
      setDataSource(new StringFilter());
    }
    return dataSource;
  }

  public void setDataSource(StringFilter dataSource) {
    this.dataSource = dataSource;
  }

  public StringFilter getDataUser() {
    return dataUser;
  }

  public Optional<StringFilter> optionalDataUser() {
    return Optional.ofNullable(dataUser);
  }

  public StringFilter dataUser() {
    if (dataUser == null) {
      setDataUser(new StringFilter());
    }
    return dataUser;
  }

  public void setDataUser(StringFilter dataUser) {
    this.dataUser = dataUser;
  }

  public StringFilter getDataComments() {
    return dataComments;
  }

  public Optional<StringFilter> optionalDataComments() {
    return Optional.ofNullable(dataComments);
  }

  public StringFilter dataComments() {
    if (dataComments == null) {
      setDataComments(new StringFilter());
    }
    return dataComments;
  }

  public void setDataComments(StringFilter dataComments) {
    this.dataComments = dataComments;
  }

  public InstantFilter getCreationDate() {
    return creationDate;
  }

  public Optional<InstantFilter> optionalCreationDate() {
    return Optional.ofNullable(creationDate);
  }

  public InstantFilter creationDate() {
    if (creationDate == null) {
      setCreationDate(new InstantFilter());
    }
    return creationDate;
  }

  public void setCreationDate(InstantFilter creationDate) {
    this.creationDate = creationDate;
  }

  public StringFilter getCreationUsername() {
    return creationUsername;
  }

  public Optional<StringFilter> optionalCreationUsername() {
    return Optional.ofNullable(creationUsername);
  }

  public StringFilter creationUsername() {
    if (creationUsername == null) {
      setCreationUsername(new StringFilter());
    }
    return creationUsername;
  }

  public void setCreationUsername(StringFilter creationUsername) {
    this.creationUsername = creationUsername;
  }

  public IntegerFilter getVersion() {
    return version;
  }

  public Optional<IntegerFilter> optionalVersion() {
    return Optional.ofNullable(version);
  }

  public IntegerFilter version() {
    if (version == null) {
      setVersion(new IntegerFilter());
    }
    return version;
  }

  public void setVersion(IntegerFilter version) {
    this.version = version;
  }

  public LongFilter getInputDataId() {
    return inputDataId;
  }

  public Optional<LongFilter> optionalInputDataId() {
    return Optional.ofNullable(inputDataId);
  }

  public LongFilter inputDataId() {
    if (inputDataId == null) {
      setInputDataId(new LongFilter());
    }
    return inputDataId;
  }

  public void setInputDataId(LongFilter inputDataId) {
    this.inputDataId = inputDataId;
  }

  public LongFilter getVariableId() {
    return variableId;
  }

  public Optional<LongFilter> optionalVariableId() {
    return Optional.ofNullable(variableId);
  }

  public LongFilter variableId() {
    if (variableId == null) {
      setVariableId(new LongFilter());
    }
    return variableId;
  }

  public void setVariableId(LongFilter variableId) {
    this.variableId = variableId;
  }

  public StringFilter getVariableNameOrCode() {
    return variableNameOrCode;
  }

  public Optional<StringFilter> optionalVariableNameOrCode() {
    return Optional.ofNullable(variableNameOrCode);
  }

  public StringFilter variableNameOrCode() {
    if (variableNameOrCode == null) {
      setVariableNameOrCode(new StringFilter());
    }
    return variableNameOrCode;
  }

  public void setVariableNameOrCode(StringFilter variableNameOrCode) {
    this.variableNameOrCode = variableNameOrCode;
  }

  public StringFilter getVariableClassNameOrCode() {
    return variableClassNameOrCode;
  }

  public Optional<StringFilter> optionalVariableClassNameOrCode() {
    return Optional.ofNullable(variableClassNameOrCode);
  }

  public StringFilter variableClassNameOrCode() {
    if (variableClassNameOrCode == null) {
      setVariableClassNameOrCode(new StringFilter());
    }
    return variableClassNameOrCode;
  }

  public void setVariableClassNameOrCode(StringFilter variableClassNameOrCode) {
    this.variableClassNameOrCode = variableClassNameOrCode;
  }

  public LongFilter getPeriodId() {
    return periodId;
  }

  public Optional<LongFilter> optionalPeriodId() {
    return Optional.ofNullable(periodId);
  }

  public LongFilter periodId() {
    if (periodId == null) {
      setPeriodId(new LongFilter());
    }
    return periodId;
  }

  public void setPeriodId(LongFilter periodId) {
    this.periodId = periodId;
  }

  public LongFilter getSourceUnitId() {
    return sourceUnitId;
  }

  public Optional<LongFilter> optionalSourceUnitId() {
    return Optional.ofNullable(sourceUnitId);
  }

  public LongFilter sourceUnitId() {
    if (sourceUnitId == null) {
      setSourceUnitId(new LongFilter());
    }
    return sourceUnitId;
  }

  public void setSourceUnitId(LongFilter sourceUnitId) {
    this.sourceUnitId = sourceUnitId;
  }

  public LongFilter getUnitId() {
    return unitId;
  }

  public Optional<LongFilter> optionalUnitId() {
    return Optional.ofNullable(unitId);
  }

  public LongFilter unitId() {
    if (unitId == null) {
      setUnitId(new LongFilter());
    }
    return unitId;
  }

  public void setUnitId(LongFilter unitId) {
    this.unitId = unitId;
  }

  public LongFilter getOwnerId() {
    return ownerId;
  }

  public Optional<LongFilter> optionalOwnerId() {
    return Optional.ofNullable(ownerId);
  }

  public LongFilter ownerId() {
    if (ownerId == null) {
      setOwnerId(new LongFilter());
    }
    return ownerId;
  }

  public void setOwnerId(LongFilter ownerId) {
    this.ownerId = ownerId;
  }

  public LongFilter getScopeId() {
    return scopeId;
  }

  public Optional<LongFilter> optionalScopeId() {
    return Optional.ofNullable(scopeId);
  }

  public LongFilter scopeId() {
    if (scopeId == null) {
      setScopeId(new LongFilter());
    }
    return scopeId;
  }

  public void setScopeId(LongFilter scopeId) {
    this.scopeId = scopeId;
  }

  public LongFilter getCategoryId() {
    return categoryId;
  }

  public Optional<LongFilter> optionalCategoryId() {
    return Optional.ofNullable(categoryId);
  }

  public LongFilter categoryId() {
    if (categoryId == null) {
      setCategoryId(new LongFilter());
    }
    return categoryId;
  }

  public void setCategoryId(LongFilter categoryId) {
    this.categoryId = categoryId;
  }

  public LongFilter getVariableScopeId() {
    return variableScopeId;
  }

  public Optional<LongFilter> optionalVariableScopeId() {
    return Optional.ofNullable(variableScopeId);
  }

  public LongFilter variableScopeId() {
    if (scopeId == null) {
      setVariableScopeId(new LongFilter());
    }
    return variableScopeId;
  }

  public void setVariableScopeId(LongFilter variableScopeId) {
    this.variableScopeId = variableScopeId;
  }

  public LongFilter getVariableCategoryId() {
    return variableCategoryId;
  }

  public Optional<LongFilter> optionalVariableCategoryId() {
    return Optional.ofNullable(variableCategoryId);
  }

  public LongFilter variableCategoryId() {
    if (variableCategoryId == null) {
      setVariableCategoryId(new LongFilter());
    }
    return variableCategoryId;
  }

  public void setVariableCategoryId(LongFilter variableCategoryId) {
    this.variableCategoryId = variableCategoryId;
  }

  public LongFilter getSourceInputDataId() {
    return sourceInputDataId;
  }

  public Optional<LongFilter> optionalSourceInputDataId() {
    return Optional.ofNullable(sourceInputDataId);
  }

  public LongFilter sourceInputDataId() {
    if (sourceInputDataId == null) {
      setSourceInputDataId(new LongFilter());
    }
    return sourceInputDataId;
  }

  public void setSourceInputDataId(LongFilter sourceInputDataId) {
    this.sourceInputDataId = sourceInputDataId;
  }

  public LongFilter getSourceInputDataUploadId() {
    return sourceInputDataUploadId;
  }

  public Optional<LongFilter> optionalSourceInputDataUploadId() {
    return Optional.ofNullable(sourceInputDataUploadId);
  }

  public LongFilter sourceInputDataUploadId() {
    if (sourceInputDataUploadId == null) {
      setSourceInputDataUploadId(new LongFilter());
    }
    return sourceInputDataUploadId;
  }

  public void setSourceInputDataUploadId(LongFilter sourceInputDataUploadId) {
    this.sourceInputDataUploadId = sourceInputDataUploadId;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    final InputDataCriteria that = (InputDataCriteria) o;
    // @formatter:off
    return (Objects.equals(id, that.id) && Objects.equals(sourceValue, that.sourceValue)
        && Objects.equals(variableValue, that.variableValue) && Objects.equals(imputedValue, that.imputedValue)
        && Objects.equals(sourceType, that.sourceType) && Objects.equals(dataDate, that.dataDate)
        && Objects.equals(changeDate, that.changeDate) && Objects.equals(changeUsername, that.changeUsername)
        && Objects.equals(dataSource, that.dataSource) && Objects.equals(dataUser, that.dataUser)
        && Objects.equals(dataComments, that.dataComments) && Objects.equals(creationDate, that.creationDate)
        && Objects.equals(creationUsername, that.creationUsername) && Objects.equals(version, that.version)
        && Objects.equals(inputDataId, that.inputDataId) && Objects.equals(variableId, that.variableId)
        && Objects.equals(variableNameOrCode, that.variableNameOrCode) && Objects.equals(periodId, that.periodId)
        && Objects.equals(variableClassNameOrCode, that.variableClassNameOrCode) && Objects.equals(unitId, that.unitId)
        && Objects.equals(ownerId, that.ownerId) && Objects.equals(sourceInputDataId, that.sourceInputDataId)
        && Objects.equals(sourceInputDataUploadId, that.sourceInputDataUploadId)
        && Objects.equals(scopeId, that.scopeId) 
        && Objects.equals(categoryId, that.categoryId)
        && Objects.equals(variableScopeId, that.variableScopeId)
        && Objects.equals(variableCategoryId, that.variableCategoryId) && super.equals(o));
    // @formatter:on
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, sourceValue, variableValue, imputedValue, sourceType, dataDate, changeDate, changeUsername,
        dataSource, dataUser, dataComments, creationDate, creationUsername, version, inputDataId, variableId,
        variableNameOrCode, variableClassNameOrCode, periodId, sourceUnitId, unitId, ownerId, sourceInputDataId,
        sourceInputDataUploadId, super.hashCode());
  }

  // prettier-ignore
  @Override
  public String toString() {
    return "InputDataCriteria{" + optionalId().map(f -> "id=" + f + ", ").orElse("")
        + optionalSourceValue().map(f -> "sourceValue=" + f + ", ").orElse("")
        + optionalVariableValue().map(f -> "variableValue=" + f + ", ").orElse("")
        + optionalImputedValue().map(f -> "imputedValue=" + f + ", ").orElse("")
        + optionalSourceType().map(f -> "sourceType=" + f + ", ").orElse("")
        + optionalDataDate().map(f -> "dataDate=" + f + ", ").orElse("")
        + optionalChangeDate().map(f -> "changeDate=" + f + ", ").orElse("")
        + optionalChangeUsername().map(f -> "changeUsername=" + f + ", ").orElse("")
        + optionalDataSource().map(f -> "dataSource=" + f + ", ").orElse("")
        + optionalDataUser().map(f -> "dataUser=" + f + ", ").orElse("")
        + optionalDataComments().map(f -> "dataComments=" + f + ", ").orElse("")
        + optionalCreationDate().map(f -> "creationDate=" + f + ", ").orElse("")
        + optionalCreationUsername().map(f -> "creationUsername=" + f + ", ").orElse("")
        + optionalVersion().map(f -> "version=" + f + ", ").orElse("")
        + optionalInputDataId().map(f -> "inputDataId=" + f + ", ").orElse("")
        + optionalVariableId().map(f -> "variableId=" + f + ", ").orElse("")
        + optionalVariableNameOrCode().map(f -> "variableNameOrCode=" + f + ", ").orElse("")
        + optionalVariableClassNameOrCode().map(f -> "variableClassNameOrCode=" + f + ", ").orElse("")
        + optionalPeriodId().map(f -> "periodId=" + f + ", ").orElse("")
        + optionalSourceUnitId().map(f -> "sourceUnitId=" + f + ", ").orElse("")
        + optionalUnitId().map(f -> "unitId=" + f + ", ").orElse("")
        + optionalOwnerId().map(f -> "ownerId=" + f + ", ").orElse("")
        + optionalScopeId().map(f -> "scopeId=" + f + ", ").orElse("")
        + optionalCategoryId().map(f -> "categoryId=" + f + ", ").orElse("")
        + optionalSourceInputDataId().map(f -> "sourceInputDataId=" + f + ", ").orElse("")
        + optionalSourceInputDataUploadId().map(f -> "sourceInputDataUploadId=" + f + ", ").orElse("")
        + super.toString() + "}";
  }
}
