187 lines
4.9 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.util.UUID;
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;
/**
* 可验证的上下文引用;服务端按 owner、作品归属和权限重新取数。
*/
@Schema(name = "AiContextRef", description = "可验证的上下文引用;服务端按 owner、作品归属和权限重新取数。")
@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 AiContextRef implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 引用类型
*/
public enum RefTypeEnum {
WORK("work"),
CHAPTER("chapter"),
BLOCK("block");
private final String value;
RefTypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static RefTypeEnum fromValue(String value) {
for (RefTypeEnum b : RefTypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
private RefTypeEnum refType;
private UUID refId;
private @Nullable Integer expectedRevision;
public AiContextRef() {
super();
}
/**
* Constructor with only required parameters
*/
public AiContextRef(RefTypeEnum refType, UUID refId) {
this.refType = refType;
this.refId = refId;
}
public AiContextRef refType(RefTypeEnum refType) {
this.refType = refType;
return this;
}
/**
* 引用类型
* @return refType
*/
@NotNull
@Schema(name = "refType", description = "引用类型", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("refType")
public RefTypeEnum getRefType() {
return refType;
}
@JsonProperty("refType")
public void setRefType(RefTypeEnum refType) {
this.refType = refType;
}
public AiContextRef refId(UUID refId) {
this.refId = refId;
return this;
}
/**
* 引用对象 IDchapter/block 必须属于 workId 指向的作品。
* @return refId
*/
@NotNull @Valid
@Schema(name = "refId", description = "引用对象 IDchapter/block 必须属于 workId 指向的作品。", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("refId")
public UUID getRefId() {
return refId;
}
@JsonProperty("refId")
public void setRefId(UUID refId) {
this.refId = refId;
}
public AiContextRef expectedRevision(@Nullable Integer expectedRevision) {
this.expectedRevision = expectedRevision;
return this;
}
/**
* 调用方看到的对象 revision仅用于 stale 检测,不授予权限。
* @return expectedRevision
*/
@Schema(name = "expectedRevision", description = "调用方看到的对象 revision仅用于 stale 检测,不授予权限。", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("expectedRevision")
public @Nullable Integer getExpectedRevision() {
return expectedRevision;
}
@JsonProperty("expectedRevision")
public void setExpectedRevision(@Nullable Integer expectedRevision) {
this.expectedRevision = expectedRevision;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AiContextRef aiContextRef = (AiContextRef) o;
return Objects.equals(this.refType, aiContextRef.refType) &&
Objects.equals(this.refId, aiContextRef.refId) &&
Objects.equals(this.expectedRevision, aiContextRef.expectedRevision);
}
@Override
public int hashCode() {
return Objects.hash(refType, refId, expectedRevision);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AiContextRef {\n");
sb.append(" refType: ").append(toIndentedString(refType)).append("\n");
sb.append(" refId: ").append(toIndentedString(refId)).append("\n");
sb.append(" expectedRevision: ").append(toIndentedString(expectedRevision)).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 ");
}
}