341 lines
9.3 KiB
Java
341 lines
9.3 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.util.ArrayList;
|
||
import java.util.Arrays;
|
||
import java.util.List;
|
||
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;
|
||
|
||
/**
|
||
* 异常内容治理动作请求
|
||
*/
|
||
|
||
@Schema(name = "RiskActionRequest", 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 RiskActionRequest implements Serializable {
|
||
|
||
private static final long serialVersionUID = 1L;
|
||
|
||
private String commandId;
|
||
|
||
/**
|
||
* 治理动作类型: warn - 发出警告通知 restrict - 限制部分功能 block_content - 阻断内容访问 force_archive - 强制归档作品 notify_owner - 通知作品所有者
|
||
*/
|
||
public enum ActionEnum {
|
||
WARN("warn"),
|
||
|
||
RESTRICT("restrict"),
|
||
|
||
BLOCK_CONTENT("block_content"),
|
||
|
||
FORCE_ARCHIVE("force_archive"),
|
||
|
||
NOTIFY_OWNER("notify_owner");
|
||
|
||
private final String value;
|
||
|
||
ActionEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static ActionEnum fromValue(String value) {
|
||
for (ActionEnum b : ActionEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private ActionEnum action;
|
||
|
||
private String reason;
|
||
|
||
/**
|
||
* 治理范围粒度,默认 work
|
||
*/
|
||
public enum TargetScopeEnum {
|
||
WORK("work"),
|
||
|
||
CHAPTER("chapter"),
|
||
|
||
BLOCK("block");
|
||
|
||
private final String value;
|
||
|
||
TargetScopeEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static TargetScopeEnum fromValue(String value) {
|
||
for (TargetScopeEnum b : TargetScopeEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private @Nullable TargetScopeEnum targetScope;
|
||
|
||
@Valid
|
||
private List<UUID> targetIds = new ArrayList<>();
|
||
|
||
private @Nullable Integer expectedVersion;
|
||
|
||
private @Nullable String duration;
|
||
|
||
public RiskActionRequest() {
|
||
super();
|
||
}
|
||
|
||
/**
|
||
* Constructor with only required parameters
|
||
*/
|
||
public RiskActionRequest(String commandId, ActionEnum action, String reason) {
|
||
this.commandId = commandId;
|
||
this.action = action;
|
||
this.reason = reason;
|
||
}
|
||
|
||
public RiskActionRequest commandId(String commandId) {
|
||
this.commandId = commandId;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 幂等键
|
||
* @return commandId
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "commandId", description = "幂等键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("commandId")
|
||
public String getCommandId() {
|
||
return commandId;
|
||
}
|
||
|
||
@JsonProperty("commandId")
|
||
public void setCommandId(String commandId) {
|
||
this.commandId = commandId;
|
||
}
|
||
|
||
public RiskActionRequest action(ActionEnum action) {
|
||
this.action = action;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 治理动作类型: warn - 发出警告通知 restrict - 限制部分功能 block_content - 阻断内容访问 force_archive - 强制归档作品 notify_owner - 通知作品所有者
|
||
* @return action
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "action", description = "治理动作类型: warn - 发出警告通知 restrict - 限制部分功能 block_content - 阻断内容访问 force_archive - 强制归档作品 notify_owner - 通知作品所有者 ", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("action")
|
||
public ActionEnum getAction() {
|
||
return action;
|
||
}
|
||
|
||
@JsonProperty("action")
|
||
public void setAction(ActionEnum action) {
|
||
this.action = action;
|
||
}
|
||
|
||
public RiskActionRequest reason(String reason) {
|
||
this.reason = reason;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 治理原因,必须填写
|
||
* @return reason
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "reason", description = "治理原因,必须填写", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("reason")
|
||
public String getReason() {
|
||
return reason;
|
||
}
|
||
|
||
@JsonProperty("reason")
|
||
public void setReason(String reason) {
|
||
this.reason = reason;
|
||
}
|
||
|
||
public RiskActionRequest targetScope(@Nullable TargetScopeEnum targetScope) {
|
||
this.targetScope = targetScope;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 治理范围粒度,默认 work
|
||
* @return targetScope
|
||
*/
|
||
|
||
@Schema(name = "targetScope", description = "治理范围粒度,默认 work", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("targetScope")
|
||
public @Nullable TargetScopeEnum getTargetScope() {
|
||
return targetScope;
|
||
}
|
||
|
||
@JsonProperty("targetScope")
|
||
public void setTargetScope(@Nullable TargetScopeEnum targetScope) {
|
||
this.targetScope = targetScope;
|
||
}
|
||
|
||
public RiskActionRequest targetIds(List<UUID> targetIds) {
|
||
this.targetIds = targetIds;
|
||
return this;
|
||
}
|
||
|
||
public RiskActionRequest addTargetIdsItem(UUID targetIdsItem) {
|
||
if (this.targetIds == null) {
|
||
this.targetIds = new ArrayList<>();
|
||
}
|
||
this.targetIds.add(targetIdsItem);
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 指定治理的章节或 Block ID(粒度非 work 时必填)
|
||
* @return targetIds
|
||
*/
|
||
@Valid
|
||
@Schema(name = "targetIds", description = "指定治理的章节或 Block ID(粒度非 work 时必填)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("targetIds")
|
||
public List<UUID> getTargetIds() {
|
||
return targetIds;
|
||
}
|
||
|
||
@JsonProperty("targetIds")
|
||
public void setTargetIds(List<UUID> targetIds) {
|
||
this.targetIds = targetIds;
|
||
}
|
||
|
||
public RiskActionRequest expectedVersion(@Nullable Integer expectedVersion) {
|
||
this.expectedVersion = expectedVersion;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 作品当前版本号,用于乐观锁
|
||
* @return expectedVersion
|
||
*/
|
||
|
||
@Schema(name = "expectedVersion", description = "作品当前版本号,用于乐观锁", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("expectedVersion")
|
||
public @Nullable Integer getExpectedVersion() {
|
||
return expectedVersion;
|
||
}
|
||
|
||
@JsonProperty("expectedVersion")
|
||
public void setExpectedVersion(@Nullable Integer expectedVersion) {
|
||
this.expectedVersion = expectedVersion;
|
||
}
|
||
|
||
public RiskActionRequest duration(@Nullable String duration) {
|
||
this.duration = duration;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 限制时长,如 P7D(7 天),仅 restrict 动作适用
|
||
* @return duration
|
||
*/
|
||
|
||
@Schema(name = "duration", description = "限制时长,如 P7D(7 天),仅 restrict 动作适用", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("duration")
|
||
public @Nullable String getDuration() {
|
||
return duration;
|
||
}
|
||
|
||
@JsonProperty("duration")
|
||
public void setDuration(@Nullable String duration) {
|
||
this.duration = duration;
|
||
}
|
||
|
||
@Override
|
||
public boolean equals(Object o) {
|
||
if (this == o) {
|
||
return true;
|
||
}
|
||
if (o == null || getClass() != o.getClass()) {
|
||
return false;
|
||
}
|
||
RiskActionRequest riskActionRequest = (RiskActionRequest) o;
|
||
return Objects.equals(this.commandId, riskActionRequest.commandId) &&
|
||
Objects.equals(this.action, riskActionRequest.action) &&
|
||
Objects.equals(this.reason, riskActionRequest.reason) &&
|
||
Objects.equals(this.targetScope, riskActionRequest.targetScope) &&
|
||
Objects.equals(this.targetIds, riskActionRequest.targetIds) &&
|
||
Objects.equals(this.expectedVersion, riskActionRequest.expectedVersion) &&
|
||
Objects.equals(this.duration, riskActionRequest.duration);
|
||
}
|
||
|
||
@Override
|
||
public int hashCode() {
|
||
return Objects.hash(commandId, action, reason, targetScope, targetIds, expectedVersion, duration);
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
StringBuilder sb = new StringBuilder();
|
||
sb.append("class RiskActionRequest {\n");
|
||
sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n");
|
||
sb.append(" action: ").append(toIndentedString(action)).append("\n");
|
||
sb.append(" reason: ").append(toIndentedString(reason)).append("\n");
|
||
sb.append(" targetScope: ").append(toIndentedString(targetScope)).append("\n");
|
||
sb.append(" targetIds: ").append(toIndentedString(targetIds)).append("\n");
|
||
sb.append(" expectedVersion: ").append(toIndentedString(expectedVersion)).append("\n");
|
||
sb.append(" duration: ").append(toIndentedString(duration)).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 ");
|
||
}
|
||
}
|
||
|