forked from mtusi2026/mtusi2026lab5
61 lines
1.4 KiB
Java
61 lines
1.4 KiB
Java
package ru.mtusi.messenger.dto;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
|
import jakarta.validation.constraints.NotNull;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.UUID;
|
|
|
|
@Schema(name = "CreateMessage")
|
|
public class CreateMessageDTO {
|
|
|
|
private String text;
|
|
|
|
private List<UUID> attachmentIds = new ArrayList<>();
|
|
|
|
public CreateMessageDTO() {}
|
|
|
|
public CreateMessageDTO text(String text) {
|
|
this.text = text;
|
|
return this;
|
|
}
|
|
|
|
@NotNull
|
|
@Schema(name = "text", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("text")
|
|
public String getText() {
|
|
return text;
|
|
}
|
|
|
|
public void setText(String text) {
|
|
this.text = text;
|
|
}
|
|
|
|
@Schema(name = "attachment_ids", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("attachment_ids")
|
|
public List<UUID> getAttachmentIds() {
|
|
return attachmentIds;
|
|
}
|
|
|
|
public void setAttachmentIds(List<UUID> attachmentIds) {
|
|
this.attachmentIds = attachmentIds;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) return true;
|
|
if (!(o instanceof CreateMessageDTO d)) return false;
|
|
return Objects.equals(text, d.text) && Objects.equals(attachmentIds, d.attachmentIds);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(text, attachmentIds);
|
|
}
|
|
}
|