dev.crashteam.openapi.keanalytics.model.PromoCode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-ke-analytics Show documentation
Show all versions of openapi-ke-analytics Show documentation
Generates jar artifact containing compiled openapi classes based on generated openapi yaml files
The newest version!
package dev.crashteam.openapi.keanalytics.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import dev.crashteam.openapi.keanalytics.model.PromoCodeContext;
import java.time.OffsetDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Промокод для применения при покупке
*/
@Schema(name = "PromoCode", description = "Промокод для применения при покупке")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-03-26T08:59:12.399131532Z[Etc/UTC]")
public class PromoCode {
private String code;
private String prefix;
private String description;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private OffsetDateTime validUntil;
private Integer useLimit;
private PromoCodeContext context;
/**
* Default constructor
* @deprecated Use {@link PromoCode#PromoCode(String, String, OffsetDateTime, Integer, PromoCodeContext)}
*/
@Deprecated
public PromoCode() {
super();
}
/**
* Constructor with only required parameters
*/
public PromoCode(String code, String description, OffsetDateTime validUntil, Integer useLimit, PromoCodeContext context) {
this.code = code;
this.description = description;
this.validUntil = validUntil;
this.useLimit = useLimit;
this.context = context;
}
public PromoCode code(String code) {
this.code = code;
return this;
}
/**
* Get code
* @return code
*/
@Schema(name = "code", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("code")
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public PromoCode prefix(String prefix) {
this.prefix = prefix;
return this;
}
/**
* Префикс для промокода
* @return prefix
*/
@Schema(name = "prefix", example = "MDB-", description = "Префикс для промокода", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("prefix")
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public PromoCode description(String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
*/
@NotNull
@Schema(name = "description", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("description")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public PromoCode validUntil(OffsetDateTime validUntil) {
this.validUntil = validUntil;
return this;
}
/**
* Дата окончания действия промокода
* @return validUntil
*/
@NotNull @Valid
@Schema(name = "validUntil", description = "Дата окончания действия промокода", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("validUntil")
public OffsetDateTime getValidUntil() {
return validUntil;
}
public void setValidUntil(OffsetDateTime validUntil) {
this.validUntil = validUntil;
}
public PromoCode useLimit(Integer useLimit) {
this.useLimit = useLimit;
return this;
}
/**
* Максимальное кол-во использований промокода
* @return useLimit
*/
@NotNull
@Schema(name = "useLimit", description = "Максимальное кол-во использований промокода", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("useLimit")
public Integer getUseLimit() {
return useLimit;
}
public void setUseLimit(Integer useLimit) {
this.useLimit = useLimit;
}
public PromoCode context(PromoCodeContext context) {
this.context = context;
return this;
}
/**
* Get context
* @return context
*/
@NotNull @Valid
@Schema(name = "context", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("context")
public PromoCodeContext getContext() {
return context;
}
public void setContext(PromoCodeContext context) {
this.context = context;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PromoCode promoCode = (PromoCode) o;
return Objects.equals(this.code, promoCode.code) &&
Objects.equals(this.prefix, promoCode.prefix) &&
Objects.equals(this.description, promoCode.description) &&
Objects.equals(this.validUntil, promoCode.validUntil) &&
Objects.equals(this.useLimit, promoCode.useLimit) &&
Objects.equals(this.context, promoCode.context);
}
@Override
public int hashCode() {
return Objects.hash(code, prefix, description, validUntil, useLimit, context);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PromoCode {\n");
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" validUntil: ").append(toIndentedString(validUntil)).append("\n");
sb.append(" useLimit: ").append(toIndentedString(useLimit)).append("\n");
sb.append(" context: ").append(toIndentedString(context)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}