package ru.mtusi.messenger.dto; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import jakarta.validation.Valid; import jakarta.validation.constraints.*; import io.swagger.v3.oas.annotations.media.Schema; import java.util.*; /** * ChatPageDTO */ public class ChatPageDTO { @Valid private List<@Valid ChatDTO> items = new ArrayList<>(); private String nextCursor = null; public ChatPageDTO() { super(); } /** * Constructor with only required parameters */ public ChatPageDTO(List<@Valid ChatDTO> items, String nextCursor) { this.items = items; this.nextCursor = nextCursor; } public ChatPageDTO items(List<@Valid ChatDTO> items) { this.items = items; return this; } public ChatPageDTO addItemsItem(ChatDTO 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 ChatDTO> getItems() { return items; } public void setItems(List<@Valid ChatDTO> items) { this.items = items; } public ChatPageDTO nextCursor(String nextCursor) { this.nextCursor = nextCursor; return this; } /** * Get nextCursor * @return nextCursor */ @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; } ChatPageDTO chatPageDTO = (ChatPageDTO) o; return Objects.equals(this.items, chatPageDTO.items) && Objects.equals(this.nextCursor, chatPageDTO.nextCursor); } @Override public int hashCode() { return Objects.hash(items, nextCursor); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ChatPageDTO {\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 "); } }