// WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema

package com.getbase.models;

import com.fasterxml.jackson.annotation.JsonView;
import com.getbase.serializer.Views;
import org.joda.time.DateTime;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.getbase.utils.Precondition.checkNotNull;

public class Deal {
  protected @JsonView(Views.ReadOnly.class) Long id;
  protected @JsonView(Views.ReadOnly.class) Long creatorId;
  protected @JsonView(Views.ReadOnly.class) Long organizationId;
  protected @JsonView(Views.ReadOnly.class) DateTime createdAt;
  protected @JsonView(Views.ReadOnly.class) String dropboxEmail;
  protected @JsonView(Views.ReadOnly.class) DateTime updatedAt;
  protected @JsonView(Views.ReadWrite.class) Long contactId;
  protected @JsonView(Views.ReadWrite.class) Long lossReasonId;
  protected @JsonView(Views.ReadWrite.class) Long ownerId;
  protected @JsonView(Views.ReadWrite.class) Long sourceId;
  protected @JsonView(Views.ReadWrite.class) Long stageId;
  protected @JsonView(Views.ReadWrite.class) String currency;
  protected @JsonView(Views.ReadWrite.class) Boolean hot;
  protected @JsonView(Views.ReadWrite.class) String name;
  protected @JsonView(Views.ReadWrite.class) BigDecimal value;
  protected @JsonView(Views.ReadWrite.class) List<String> tags = new ArrayList<String>();
  protected @JsonView(Views.ReadWrite.class) Map<String, Object> customFields = new HashMap<String, Object>();
  protected @JsonView(Views.ReadWrite.class) DateTime lastStageChangeAt;
  protected @JsonView(Views.ReadOnly.class) Long lastStageChangeById;
  protected @JsonView(Views.ReadOnly.class) DateTime lastActivityAt;
  protected @JsonView(Views.ReadWrite.class) DateTime estimatedCloseDate;
  protected @JsonView(Views.ReadWrite.class) Integer customizedWinLikelihood;
  protected @JsonView(Views.ReadWrite.class) DateTime addedOn;

  public Deal() {
  }

  public Long getId() {
    return this.id;
  }

  public Long getCreatorId() {
    return this.creatorId;
  }

  public Long getOrganizationId() {
    return this.organizationId;
  }

  public DateTime getCreatedAt() {
    return this.createdAt;
  }

  public String getDropboxEmail() {
    return this.dropboxEmail;
  }

  public DateTime getUpdatedAt() {
    return this.updatedAt;
  }

  public Long getContactId() {
    return this.contactId;
  }

  public Long getLossReasonId() {
    return this.lossReasonId;
  }

  public Long getOwnerId() {
    return this.ownerId;
  }

  public Long getSourceId() {
    return this.sourceId;
  }

  public Long getStageId() {
    return this.stageId;
  }

  public String getCurrency() {
    return this.currency;
  }

  public Boolean getHot() {
    return this.hot;
  }

  public String getName() {
    return this.name;
  }

  public BigDecimal getValue() {
    return this.value;
  }

  public List<String> getTags() {
    return this.tags;
  }

  public Map<String, Object> getCustomFields() {
    return this.customFields;
  }

  public DateTime getLastStageChangeAt() {
    return this.lastStageChangeAt;
  }

  public Long getLastStageChangeById() {
    return this.lastStageChangeById;
  }

  public DateTime getLastActivityAt() {
    return this.lastActivityAt;
  }

  public DateTime getEstimatedCloseDate() {
    return this.estimatedCloseDate;
  }

  public Integer getCustomizedWinLikelihood() {
    return this.customizedWinLikelihood;
  }

  public DateTime getAddedOn() {
    return this.addedOn;
  }

  public void setContactId(long contactId) {
    this.contactId = contactId;
  }

  public void setLossReasonId(long lossReasonId) {
    this.lossReasonId = lossReasonId;
  }

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

  public void setSourceId(long sourceId) {
    this.sourceId = sourceId;
  }

  public void setStageId(long stageId) {
    this.stageId = stageId;
  }

  public void setCurrency(String currency) {
    this.currency = currency;
  }

  public void setHot(boolean hot) {
    this.hot = hot;
  }

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

  public void setValue(BigDecimal value) {
    this.value = value;
  }

  public void setTags(List<String> tags) {
    checkNotNull(tags, "tags must not be null.");
    this.tags = tags;
  }

  public void setCustomFields(Map<String, Object> customFields) {
    checkNotNull(customFields, "customFields must not be null.");
    this.customFields = customFields;
  }

  public void setLastStageChangeAt(DateTime lastStageChangeAt) {
    this.lastStageChangeAt = lastStageChangeAt;
  }

  public void setEstimatedCloseDate(DateTime estimatedCloseDate) {
    this.estimatedCloseDate = estimatedCloseDate;
  }

  public void setCustomizedWinLikelihood(int customizedWinLikelihood) {
    this.customizedWinLikelihood = customizedWinLikelihood;
  }

  public void setAddedOn(DateTime addedOn) {
    return this.addedOn = addedOn;
  }

  @Override
  public String toString() {
    return "Deal{" +
          "id=" + id +
          ", creatorId=" + creatorId +
          ", organizationId=" + organizationId +
          ", createdAt=" + createdAt +
          ", dropboxEmail='" + dropboxEmail + '\'' +
          ", updatedAt=" + updatedAt +
          ", contactId=" + contactId +
          ", lossReasonId=" + lossReasonId +
          ", ownerId=" + ownerId +
          ", sourceId=" + sourceId +
          ", stageId=" + stageId +
          ", currency='" + currency + '\'' +
          ", hot=" + hot +
          ", name='" + name + '\'' +
          ", value=" + value +
          ", tags=" + tags +
          ", customFields=" + customFields +
          ", lastStageChangeAt=" + lastStageChangeAt +
          ", lastStageChangeById=" + lastStageChangeById +
          ", lastActivityAt=" + lastActivityAt +
          ", estimatedCloseDate=" + estimatedCloseDate +
          ", customizedWinLikelihood=" + customizedWinLikelihood +
          ", addedOn=" + addedOn +
            "}";
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Deal deal = (Deal) o;

    if (id != null ? !id.equals(deal.id) : deal.id != null) return false;
    if (creatorId != null ? !creatorId.equals(deal.creatorId) : deal.creatorId != null) return false;
    if (organizationId != null ? !organizationId.equals(deal.organizationId) : deal.organizationId != null) return false;
    if (createdAt != null ? !createdAt.equals(deal.createdAt) : deal.createdAt != null) return false;
    if (dropboxEmail != null ? !dropboxEmail.equals(deal.dropboxEmail) : deal.dropboxEmail != null) return false;
    if (updatedAt != null ? !updatedAt.equals(deal.updatedAt) : deal.updatedAt != null) return false;
    if (contactId != null ? !contactId.equals(deal.contactId) : deal.contactId != null) return false;
    if (lossReasonId != null ? !lossReasonId.equals(deal.lossReasonId) : deal.lossReasonId != null) return false;
    if (ownerId != null ? !ownerId.equals(deal.ownerId) : deal.ownerId != null) return false;
    if (sourceId != null ? !sourceId.equals(deal.sourceId) : deal.sourceId != null) return false;
    if (stageId != null ? !stageId.equals(deal.stageId) : deal.stageId != null) return false;
    if (currency != null ? !currency.equals(deal.currency) : deal.currency != null) return false;
    if (hot != null ? !hot.equals(deal.hot) : deal.hot != null) return false;
    if (name != null ? !name.equals(deal.name) : deal.name != null) return false;
    if (value != null ? !value.equals(deal.value) : deal.value != null) return false;
    if (!tags.equals(deal.tags)) return false;
    if (!customFields.equals(deal.customFields)) return false;
    if (lastStageChangeAt != null ? !lastStageChangeAt.equals(deal.lastStageChangeAt) : deal.lastStageChangeAt != null) return false;
    if (lastStageChangeById != null ? !lastStageChangeById.equals(deal.lastStageChangeById) : deal.lastStageChangeById != null) return false;
    if (lastActivityAt != null ? !lastActivityAt.equals(deal.lastActivityAt) : deal.lastActivityAt != null) return false;
    if (estimatedCloseDate != null ? !estimatedCloseDate.equals(deal.estimatedCloseDate) : deal.estimatedCloseDate != null) return false;
    if (customizedWinLikelihood != null ? !customizedWinLikelihood.equals(deal.customizedWinLikelihood) : deal.customizedWinLikelihood != null) return false;
    if (addedOn != null ? !addedOn.equals(deal.addedOn) : deal.addedOn != null) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = id != null ? id.hashCode() : 0;
    result = 31 * result + (id != null ? id.hashCode() : 0);
    result = 31 * result + (creatorId != null ? creatorId.hashCode() : 0);
    result = 31 * result + (organizationId != null ? organizationId.hashCode() : 0);
    result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0);
    result = 31 * result + (dropboxEmail != null ? dropboxEmail.hashCode() : 0);
    result = 31 * result + (updatedAt != null ? updatedAt.hashCode() : 0);
    result = 31 * result + (contactId != null ? contactId.hashCode() : 0);
    result = 31 * result + (lossReasonId != null ? lossReasonId.hashCode() : 0);
    result = 31 * result + (ownerId != null ? ownerId.hashCode() : 0);
    result = 31 * result + (sourceId != null ? sourceId.hashCode() : 0);
    result = 31 * result + (stageId != null ? stageId.hashCode() : 0);
    result = 31 * result + (currency != null ? currency.hashCode() : 0);
    result = 31 * result + (hot != null ? hot.hashCode() : 0);
    result = 31 * result + (name != null ? name.hashCode() : 0);
    result = 31 * result + (value != null ? value.hashCode() : 0);
    result = 31 * result + tags.hashCode();
    result = 31 * result + customFields.hashCode();
    result = 31 * result + (lastStageChangeAt != null ? lastStageChangeAt.hashCode() : 0);
    result = 31 * result + (lastStageChangeById != null ? lastStageChangeById.hashCode() : 0);
    result = 31 * result + (lastActivityAt != null ? lastActivityAt.hashCode() : 0);
    result = 31 * result + (estimatedCloseDate != null ? estimatedCloseDate.hashCode() : 0);
    result = 31 * result + (customizedWinLikelihood != null ? customizedWinLikelihood.hashCode() : 0);
    result = 31 * result + (addedOn != null ? addedOn.hashCode() : 0);

    return result;
  }
}
