254 lines
6.5 KiB
Java

package com.muse.dto;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.time.OffsetDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.lang.Nullable;
import java.io.Serializable;
import java.time.OffsetDateTime;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import jakarta.annotation.Generated;
/**
* 权益项
*/
@Schema(name = "Entitlement", description = "权益项")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2026-05-24T16:47:40.290595+08:00[Asia/Shanghai]", comments = "Generator version: 7.22.0")
public class Entitlement implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String resourceType;
private Integer limit;
private Integer used;
private @Nullable Integer remaining;
private @Nullable String source;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private OffsetDateTime expiresAt;
public Entitlement() {
super();
}
/**
* Constructor with only required parameters
*/
public Entitlement(String id, String resourceType, Integer limit, Integer used, OffsetDateTime expiresAt) {
this.id = id;
this.resourceType = resourceType;
this.limit = limit;
this.used = used;
this.expiresAt = expiresAt;
}
public Entitlement id(String id) {
this.id = id;
return this;
}
/**
* 权益 ID
* @return id
*/
@NotNull
@Schema(name = "id", description = "权益 ID", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("id")
public String getId() {
return id;
}
@JsonProperty("id")
public void setId(String id) {
this.id = id;
}
public Entitlement resourceType(String resourceType) {
this.resourceType = resourceType;
return this;
}
/**
* 权益资源类型(如 ai_tokens, storage, publish_slots 等)
* @return resourceType
*/
@NotNull
@Schema(name = "resourceType", description = "权益资源类型(如 ai_tokens, storage, publish_slots 等)", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("resourceType")
public String getResourceType() {
return resourceType;
}
@JsonProperty("resourceType")
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
public Entitlement limit(Integer limit) {
this.limit = limit;
return this;
}
/**
* 额度上限(-1 表示无限制)
* @return limit
*/
@NotNull
@Schema(name = "limit", description = "额度上限(-1 表示无限制)", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("limit")
public Integer getLimit() {
return limit;
}
@JsonProperty("limit")
public void setLimit(Integer limit) {
this.limit = limit;
}
public Entitlement used(Integer used) {
this.used = used;
return this;
}
/**
* 已使用量
* @return used
*/
@NotNull
@Schema(name = "used", description = "已使用量", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("used")
public Integer getUsed() {
return used;
}
@JsonProperty("used")
public void setUsed(Integer used) {
this.used = used;
}
public Entitlement remaining(@Nullable Integer remaining) {
this.remaining = remaining;
return this;
}
/**
* 剩余额度
* @return remaining
*/
@Schema(name = "remaining", description = "剩余额度", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("remaining")
public @Nullable Integer getRemaining() {
return remaining;
}
@JsonProperty("remaining")
public void setRemaining(@Nullable Integer remaining) {
this.remaining = remaining;
}
public Entitlement source(@Nullable String source) {
this.source = source;
return this;
}
/**
* 权益来源(套餐/管理员/市场补偿等)
* @return source
*/
@Schema(name = "source", description = "权益来源(套餐/管理员/市场补偿等)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("source")
public @Nullable String getSource() {
return source;
}
@JsonProperty("source")
public void setSource(@Nullable String source) {
this.source = source;
}
public Entitlement expiresAt(OffsetDateTime expiresAt) {
this.expiresAt = expiresAt;
return this;
}
/**
* 到期时间
* @return expiresAt
*/
@NotNull @Valid
@Schema(name = "expiresAt", description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("expiresAt")
public OffsetDateTime getExpiresAt() {
return expiresAt;
}
@JsonProperty("expiresAt")
public void setExpiresAt(OffsetDateTime expiresAt) {
this.expiresAt = expiresAt;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Entitlement entitlement = (Entitlement) o;
return Objects.equals(this.id, entitlement.id) &&
Objects.equals(this.resourceType, entitlement.resourceType) &&
Objects.equals(this.limit, entitlement.limit) &&
Objects.equals(this.used, entitlement.used) &&
Objects.equals(this.remaining, entitlement.remaining) &&
Objects.equals(this.source, entitlement.source) &&
Objects.equals(this.expiresAt, entitlement.expiresAt);
}
@Override
public int hashCode() {
return Objects.hash(id, resourceType, limit, used, remaining, source, expiresAt);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Entitlement {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n");
sb.append(" limit: ").append(toIndentedString(limit)).append("\n");
sb.append(" used: ").append(toIndentedString(used)).append("\n");
sb.append(" remaining: ").append(toIndentedString(remaining)).append("\n");
sb.append(" source: ").append(toIndentedString(source)).append("\n");
sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).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(@Nullable Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}