package ru.mtusi.messenger.dto; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import ru.mtusi.messenger.dto.MessageDTO; import jakarta.validation.Valid; import jakarta.validation.constraints.*; import io.swagger.v3.oas.annotations.media.Schema; import java.util.*; /** * MessagePageDTO */ public class MessagePageDTO { @Valid private List<@Valid MessageDTO> items = new ArrayList<>(); private String nextCursor = null; public MessagePageDTO() { super(); } /** * Constructor with only required parameters */ public MessagePageDTO(List<@Valid MessageDTO> items, String nextCursor) { this.items = items; this.nextCursor = nextCursor; } public MessagePageDTO items(List<@Valid MessageDTO> items) { this.items = items; return this; } public MessagePageDTO addItemsItem(MessageDTO itemsItem) { if (this.items == null) { this.items = new ArrayList<>(); } this.items.add(itemsItem); return this; } /** * Get items * @return items */ @NotNull @Valid @Schema(name = "items", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("items") public List<@Valid MessageDTO> getItems() { return items; } public void setItems(List<@Valid MessageDTO> items) { this.items = items; } public MessagePageDTO nextCursor(String nextCursor) { this.nextCursor = nextCursor; return this; } /** * Get nextCursor * @return nextCursor */ @JsonInclude(JsonInclude.Include.ALWAYS) @Schema(name = "next_cursor", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("next_cursor") public String getNextCursor() { return nextCursor; } public void setNextCursor(String nextCursor) { this.nextCursor = nextCursor; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } MessagePageDTO messagePageDTO = (MessagePageDTO) o; return Objects.equals(this.items, messagePageDTO.items) && Objects.equals(this.nextCursor, messagePageDTO.nextCursor); } @Override public int hashCode() { return Objects.hash(items, nextCursor); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MessagePageDTO {\n"); sb.append(" items: ").append(toIndentedString(items)).append("\n"); sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).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(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }