369 lines
8.9 KiB
Java
369 lines
8.9 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 com.fasterxml.jackson.annotation.JsonValue;
|
|
import java.net.URI;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.UUID;
|
|
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;
|
|
|
|
/**
|
|
* Work
|
|
*/
|
|
|
|
@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 Work implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private UUID id;
|
|
|
|
private String title;
|
|
|
|
private @Nullable String description;
|
|
|
|
private @Nullable String genre;
|
|
|
|
private @Nullable URI coverImageUrl;
|
|
|
|
/**
|
|
* Gets or Sets status
|
|
*/
|
|
public enum StatusEnum {
|
|
DRAFT("draft"),
|
|
|
|
ACTIVE("active"),
|
|
|
|
ARCHIVED("archived");
|
|
|
|
private final String value;
|
|
|
|
StatusEnum(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
@JsonValue
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return String.valueOf(value);
|
|
}
|
|
|
|
@JsonCreator
|
|
public static StatusEnum fromValue(String value) {
|
|
for (StatusEnum b : StatusEnum.values()) {
|
|
if (b.value.equals(value)) {
|
|
return b;
|
|
}
|
|
}
|
|
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
|
}
|
|
}
|
|
|
|
private StatusEnum status;
|
|
|
|
private @Nullable Integer wordCount;
|
|
|
|
private @Nullable Integer chapterCount;
|
|
|
|
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
|
|
private OffsetDateTime createdAt;
|
|
|
|
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
|
|
private OffsetDateTime updatedAt;
|
|
|
|
public Work() {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* Constructor with only required parameters
|
|
*/
|
|
public Work(UUID id, String title, StatusEnum status, OffsetDateTime createdAt, OffsetDateTime updatedAt) {
|
|
this.id = id;
|
|
this.title = title;
|
|
this.status = status;
|
|
this.createdAt = createdAt;
|
|
this.updatedAt = updatedAt;
|
|
}
|
|
|
|
public Work id(UUID id) {
|
|
this.id = id;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get id
|
|
* @return id
|
|
*/
|
|
@NotNull @Valid
|
|
@Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("id")
|
|
public UUID getId() {
|
|
return id;
|
|
}
|
|
|
|
@JsonProperty("id")
|
|
public void setId(UUID id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public Work title(String title) {
|
|
this.title = title;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get title
|
|
* @return title
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "title", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("title")
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
@JsonProperty("title")
|
|
public void setTitle(String title) {
|
|
this.title = title;
|
|
}
|
|
|
|
public Work description(@Nullable String description) {
|
|
this.description = description;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get description
|
|
* @return description
|
|
*/
|
|
|
|
@Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("description")
|
|
public @Nullable String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
@JsonProperty("description")
|
|
public void setDescription(@Nullable String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public Work genre(@Nullable String genre) {
|
|
this.genre = genre;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get genre
|
|
* @return genre
|
|
*/
|
|
|
|
@Schema(name = "genre", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("genre")
|
|
public @Nullable String getGenre() {
|
|
return genre;
|
|
}
|
|
|
|
@JsonProperty("genre")
|
|
public void setGenre(@Nullable String genre) {
|
|
this.genre = genre;
|
|
}
|
|
|
|
public Work coverImageUrl(@Nullable URI coverImageUrl) {
|
|
this.coverImageUrl = coverImageUrl;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get coverImageUrl
|
|
* @return coverImageUrl
|
|
*/
|
|
@Valid
|
|
@Schema(name = "coverImageUrl", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("coverImageUrl")
|
|
public @Nullable URI getCoverImageUrl() {
|
|
return coverImageUrl;
|
|
}
|
|
|
|
@JsonProperty("coverImageUrl")
|
|
public void setCoverImageUrl(@Nullable URI coverImageUrl) {
|
|
this.coverImageUrl = coverImageUrl;
|
|
}
|
|
|
|
public Work status(StatusEnum status) {
|
|
this.status = status;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get status
|
|
* @return status
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "status", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("status")
|
|
public StatusEnum getStatus() {
|
|
return status;
|
|
}
|
|
|
|
@JsonProperty("status")
|
|
public void setStatus(StatusEnum status) {
|
|
this.status = status;
|
|
}
|
|
|
|
public Work wordCount(@Nullable Integer wordCount) {
|
|
this.wordCount = wordCount;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 总字数
|
|
* @return wordCount
|
|
*/
|
|
|
|
@Schema(name = "wordCount", description = "总字数", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("wordCount")
|
|
public @Nullable Integer getWordCount() {
|
|
return wordCount;
|
|
}
|
|
|
|
@JsonProperty("wordCount")
|
|
public void setWordCount(@Nullable Integer wordCount) {
|
|
this.wordCount = wordCount;
|
|
}
|
|
|
|
public Work chapterCount(@Nullable Integer chapterCount) {
|
|
this.chapterCount = chapterCount;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 章节数
|
|
* @return chapterCount
|
|
*/
|
|
|
|
@Schema(name = "chapterCount", description = "章节数", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("chapterCount")
|
|
public @Nullable Integer getChapterCount() {
|
|
return chapterCount;
|
|
}
|
|
|
|
@JsonProperty("chapterCount")
|
|
public void setChapterCount(@Nullable Integer chapterCount) {
|
|
this.chapterCount = chapterCount;
|
|
}
|
|
|
|
public Work createdAt(OffsetDateTime createdAt) {
|
|
this.createdAt = createdAt;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get createdAt
|
|
* @return createdAt
|
|
*/
|
|
@NotNull @Valid
|
|
@Schema(name = "createdAt", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("createdAt")
|
|
public OffsetDateTime getCreatedAt() {
|
|
return createdAt;
|
|
}
|
|
|
|
@JsonProperty("createdAt")
|
|
public void setCreatedAt(OffsetDateTime createdAt) {
|
|
this.createdAt = createdAt;
|
|
}
|
|
|
|
public Work updatedAt(OffsetDateTime updatedAt) {
|
|
this.updatedAt = updatedAt;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get updatedAt
|
|
* @return updatedAt
|
|
*/
|
|
@NotNull @Valid
|
|
@Schema(name = "updatedAt", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("updatedAt")
|
|
public OffsetDateTime getUpdatedAt() {
|
|
return updatedAt;
|
|
}
|
|
|
|
@JsonProperty("updatedAt")
|
|
public void setUpdatedAt(OffsetDateTime updatedAt) {
|
|
this.updatedAt = updatedAt;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (o == null || getClass() != o.getClass()) {
|
|
return false;
|
|
}
|
|
Work work = (Work) o;
|
|
return Objects.equals(this.id, work.id) &&
|
|
Objects.equals(this.title, work.title) &&
|
|
Objects.equals(this.description, work.description) &&
|
|
Objects.equals(this.genre, work.genre) &&
|
|
Objects.equals(this.coverImageUrl, work.coverImageUrl) &&
|
|
Objects.equals(this.status, work.status) &&
|
|
Objects.equals(this.wordCount, work.wordCount) &&
|
|
Objects.equals(this.chapterCount, work.chapterCount) &&
|
|
Objects.equals(this.createdAt, work.createdAt) &&
|
|
Objects.equals(this.updatedAt, work.updatedAt);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(id, title, description, genre, coverImageUrl, status, wordCount, chapterCount, createdAt, updatedAt);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("class Work {\n");
|
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
|
sb.append(" title: ").append(toIndentedString(title)).append("\n");
|
|
sb.append(" description: ").append(toIndentedString(description)).append("\n");
|
|
sb.append(" genre: ").append(toIndentedString(genre)).append("\n");
|
|
sb.append(" coverImageUrl: ").append(toIndentedString(coverImageUrl)).append("\n");
|
|
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
|
sb.append(" wordCount: ").append(toIndentedString(wordCount)).append("\n");
|
|
sb.append(" chapterCount: ").append(toIndentedString(chapterCount)).append("\n");
|
|
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
|
|
sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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 ");
|
|
}
|
|
}
|
|
|