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.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; /** * Block */ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2026-05-24T14:16:55.032756+08:00[Asia/Shanghai]", comments = "Generator version: 7.22.0") public class Block implements Serializable { private static final long serialVersionUID = 1L; private UUID id; private UUID chapterId; /** * Gets or Sets blockType */ public enum BlockTypeEnum { SCENE("scene"), SECTION("section"), NOTE("note"); private final String value; BlockTypeEnum(String value) { this.value = value; } @JsonValue public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } @JsonCreator public static BlockTypeEnum fromValue(String value) { for (BlockTypeEnum b : BlockTypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } private BlockTypeEnum blockType; private @Nullable String title; private String content; private Integer sortOrder; private Integer version; private @Nullable Integer wordCount; @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) private OffsetDateTime createdAt; @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) private OffsetDateTime updatedAt; public Block() { super(); } /** * Constructor with only required parameters */ public Block(UUID id, UUID chapterId, BlockTypeEnum blockType, String content, Integer sortOrder, Integer version, OffsetDateTime createdAt, OffsetDateTime updatedAt) { this.id = id; this.chapterId = chapterId; this.blockType = blockType; this.content = content; this.sortOrder = sortOrder; this.version = version; this.createdAt = createdAt; this.updatedAt = updatedAt; } public Block 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 Block chapterId(UUID chapterId) { this.chapterId = chapterId; return this; } /** * Get chapterId * @return chapterId */ @NotNull @Valid @Schema(name = "chapterId", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("chapterId") public UUID getChapterId() { return chapterId; } @JsonProperty("chapterId") public void setChapterId(UUID chapterId) { this.chapterId = chapterId; } public Block blockType(BlockTypeEnum blockType) { this.blockType = blockType; return this; } /** * Get blockType * @return blockType */ @NotNull @Schema(name = "blockType", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("blockType") public BlockTypeEnum getBlockType() { return blockType; } @JsonProperty("blockType") public void setBlockType(BlockTypeEnum blockType) { this.blockType = blockType; } public Block title(@Nullable String title) { this.title = title; return this; } /** * Get title * @return title */ @Schema(name = "title", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("title") public @Nullable String getTitle() { return title; } @JsonProperty("title") public void setTitle(@Nullable String title) { this.title = title; } public Block content(String content) { this.content = content; return this; } /** * ProseMirror JSON 格式的正文内容 * @return content */ @NotNull @Schema(name = "content", description = "ProseMirror JSON 格式的正文内容", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("content") public String getContent() { return content; } @JsonProperty("content") public void setContent(String content) { this.content = content; } public Block sortOrder(Integer sortOrder) { this.sortOrder = sortOrder; return this; } /** * Get sortOrder * @return sortOrder */ @NotNull @Schema(name = "sortOrder", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("sortOrder") public Integer getSortOrder() { return sortOrder; } @JsonProperty("sortOrder") public void setSortOrder(Integer sortOrder) { this.sortOrder = sortOrder; } public Block version(Integer version) { this.version = version; return this; } /** * 乐观锁版本号,每次保存 +1 * @return version */ @NotNull @Schema(name = "version", description = "乐观锁版本号,每次保存 +1", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("version") public Integer getVersion() { return version; } @JsonProperty("version") public void setVersion(Integer version) { this.version = version; } public Block wordCount(@Nullable Integer wordCount) { this.wordCount = wordCount; return this; } /** * Get wordCount * @return wordCount */ @Schema(name = "wordCount", 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 Block 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 Block 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; } Block block = (Block) o; return Objects.equals(this.id, block.id) && Objects.equals(this.chapterId, block.chapterId) && Objects.equals(this.blockType, block.blockType) && Objects.equals(this.title, block.title) && Objects.equals(this.content, block.content) && Objects.equals(this.sortOrder, block.sortOrder) && Objects.equals(this.version, block.version) && Objects.equals(this.wordCount, block.wordCount) && Objects.equals(this.createdAt, block.createdAt) && Objects.equals(this.updatedAt, block.updatedAt); } @Override public int hashCode() { return Objects.hash(id, chapterId, blockType, title, content, sortOrder, version, wordCount, createdAt, updatedAt); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Block {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" chapterId: ").append(toIndentedString(chapterId)).append("\n"); sb.append(" blockType: ").append(toIndentedString(blockType)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" sortOrder: ").append(toIndentedString(sortOrder)).append("\n"); sb.append(" version: ").append(toIndentedString(version)).append("\n"); sb.append(" wordCount: ").append(toIndentedString(wordCount)).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 "); } }