001
002package com.commercetools.api.models.standalone_price;
003
004import java.time.*;
005import java.util.*;
006
007import com.fasterxml.jackson.annotation.JsonCreator;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.*;
010
011import io.vrap.rmf.base.client.ModelBase;
012import io.vrap.rmf.base.client.utils.Generated;
013
014import org.apache.commons.lang3.builder.EqualsBuilder;
015import org.apache.commons.lang3.builder.HashCodeBuilder;
016
017/**
018 *  <p>Updating the <code>validFrom</code> and <code>validUntil</code> values generates the StandalonePriceValidFromAndUntilSet Message.</p>
019 *  <p>As the validity dates are part of the price scope and are not allowed to overlap, this update might return the DuplicateStandalonePriceScope and OverlappingStandalonePriceValidity errors, respectively. A Price without validity period does not conflict with a Price defined for a time period.</p>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class StandalonePriceSetValidFromAndUntilActionImpl
023        implements StandalonePriceSetValidFromAndUntilAction, ModelBase {
024
025    private String action;
026
027    private java.time.ZonedDateTime validFrom;
028
029    private java.time.ZonedDateTime validUntil;
030
031    /**
032     * create instance with all properties
033     */
034    @JsonCreator
035    StandalonePriceSetValidFromAndUntilActionImpl(@JsonProperty("validFrom") final java.time.ZonedDateTime validFrom,
036            @JsonProperty("validUntil") final java.time.ZonedDateTime validUntil) {
037        this.validFrom = validFrom;
038        this.validUntil = validUntil;
039        this.action = SET_VALID_FROM_AND_UNTIL;
040    }
041
042    /**
043     * create empty instance
044     */
045    public StandalonePriceSetValidFromAndUntilActionImpl() {
046        this.action = SET_VALID_FROM_AND_UNTIL;
047    }
048
049    /**
050     *
051     */
052
053    public String getAction() {
054        return this.action;
055    }
056
057    /**
058     *  <p>Value to set. If empty, any existing value is removed.</p>
059     */
060
061    public java.time.ZonedDateTime getValidFrom() {
062        return this.validFrom;
063    }
064
065    /**
066     *  <p>Value to set. If empty, any existing value is removed.</p>
067     */
068
069    public java.time.ZonedDateTime getValidUntil() {
070        return this.validUntil;
071    }
072
073    public void setValidFrom(final java.time.ZonedDateTime validFrom) {
074        this.validFrom = validFrom;
075    }
076
077    public void setValidUntil(final java.time.ZonedDateTime validUntil) {
078        this.validUntil = validUntil;
079    }
080
081    @Override
082    public boolean equals(Object o) {
083        if (this == o)
084            return true;
085
086        if (o == null || getClass() != o.getClass())
087            return false;
088
089        StandalonePriceSetValidFromAndUntilActionImpl that = (StandalonePriceSetValidFromAndUntilActionImpl) o;
090
091        return new EqualsBuilder().append(action, that.action)
092                .append(validFrom, that.validFrom)
093                .append(validUntil, that.validUntil)
094                .append(action, that.action)
095                .append(validFrom, that.validFrom)
096                .append(validUntil, that.validUntil)
097                .isEquals();
098    }
099
100    @Override
101    public int hashCode() {
102        return new HashCodeBuilder(17, 37).append(action).append(validFrom).append(validUntil).toHashCode();
103    }
104
105}