View Javadoc
1   package com.acumenvelocity.ath.model;
2   
3   import java.util.Objects;
4   
5   import com.fasterxml.jackson.annotation.JsonProperty;
6   
7   import io.swagger.annotations.ApiModelProperty;
8   
9   @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.15.0")
10  public class PaginationInfo {
11    @JsonProperty("page")
12    private Integer page;
13  
14    @JsonProperty("page_size")
15    private Integer pageSize;
16  
17    @JsonProperty("total_items")
18    private Long totalItems;
19  
20    @JsonProperty("total_pages")
21    private Integer totalPages;
22  
23    @JsonProperty("has_next")
24    private Boolean hasNext;
25  
26    @JsonProperty("has_previous")
27    private Boolean hasPrevious;
28  
29    /**
30     * Current page number (1-based)
31     * minimum: 1
32     **/
33    public PaginationInfo page(Integer page) {
34      this.page = page;
35      return this;
36    }
37  
38    @ApiModelProperty(example = "3", required = true, value = "Current page number (1-based)")
39    @JsonProperty("page")
40    public Integer getPage() {
41      return page;
42    }
43  
44    public void setPage(Integer page) {
45      this.page = page;
46    }
47  
48    /**
49     * Number of items requested per page (same as input page_size, even if last page has fewer items)
50     * minimum: 1
51     * maximum: 1000
52     **/
53    public PaginationInfo pageSize(Integer pageSize) {
54      this.pageSize = pageSize;
55      return this;
56    }
57  
58    @ApiModelProperty(example = "20", required = true, value = "Number of items requested per page (same as input page_size, even if last page has  fewer items)")
59    @JsonProperty("page_size")
60    public Integer getPageSize() {
61      return pageSize;
62    }
63  
64    public void setPageSize(Integer pageSize) {
65      this.pageSize = pageSize;
66    }
67  
68    /**
69     * Total number of items across all pages
70     **/
71    public PaginationInfo totalItems(Long totalItems) {
72      this.totalItems = totalItems;
73      return this;
74    }
75  
76    @ApiModelProperty(example = "1547", required = true, value = "Total number of items across all pages")
77    @JsonProperty("total_items")
78    public Long getTotalItems() {
79      return totalItems;
80    }
81  
82    public void setTotalItems(Long totalItems) {
83      this.totalItems = totalItems;
84    }
85  
86    /**
87     * Total number of pages (Math.ceil(total_items / page_size))
88     **/
89    public PaginationInfo totalPages(Integer totalPages) {
90      this.totalPages = totalPages;
91      return this;
92    }
93  
94    @ApiModelProperty(example = "78", required = true, value = "Total number of pages (Math.ceil(total_items / page_size))")
95    @JsonProperty("total_pages")
96    public Integer getTotalPages() {
97      return totalPages;
98    }
99  
100   public void setTotalPages(Integer totalPages) {
101     this.totalPages = totalPages;
102   }
103 
104   /**
105    * true if there is a next page
106    **/
107   public PaginationInfo hasNext(Boolean hasNext) {
108     this.hasNext = hasNext;
109     return this;
110   }
111 
112   @ApiModelProperty(example = "true", required = true, value = "true if there is a next page")
113   @JsonProperty("has_next")
114   public Boolean getHasNext() {
115     return hasNext;
116   }
117 
118   public void setHasNext(Boolean hasNext) {
119     this.hasNext = hasNext;
120   }
121 
122   /**
123    * true if there is a previous page
124    **/
125   public PaginationInfo hasPrevious(Boolean hasPrevious) {
126     this.hasPrevious = hasPrevious;
127     return this;
128   }
129 
130   @ApiModelProperty(example = "false", required = true, value = "true if there is a previous page")
131   @JsonProperty("has_previous")
132   public Boolean getHasPrevious() {
133     return hasPrevious;
134   }
135 
136   public void setHasPrevious(Boolean hasPrevious) {
137     this.hasPrevious = hasPrevious;
138   }
139 
140   @Override
141   public boolean equals(Object o) {
142     if (this == o) {
143       return true;
144     }
145     if (o == null || getClass() != o.getClass()) {
146       return false;
147     }
148     PaginationInfo paginationInfo = (PaginationInfo) o;
149     return Objects.equals(page, paginationInfo.page) &&
150         Objects.equals(pageSize, paginationInfo.pageSize) &&
151         Objects.equals(totalItems, paginationInfo.totalItems) &&
152         Objects.equals(totalPages, paginationInfo.totalPages) &&
153         Objects.equals(hasNext, paginationInfo.hasNext) &&
154         Objects.equals(hasPrevious, paginationInfo.hasPrevious);
155   }
156 
157   @Override
158   public int hashCode() {
159     return Objects.hash(page, pageSize, totalItems, totalPages, hasNext, hasPrevious);
160   }
161 
162   @Override
163   public String toString() {
164     StringBuilder sb = new StringBuilder();
165     sb.append("class PaginationInfo {\n");
166 
167     sb.append("    page: ").append(toIndentedString(page)).append("\n");
168     sb.append("    pageSize: ").append(toIndentedString(pageSize)).append("\n");
169     sb.append("    totalItems: ").append(toIndentedString(totalItems)).append("\n");
170     sb.append("    totalPages: ").append(toIndentedString(totalPages)).append("\n");
171     sb.append("    hasNext: ").append(toIndentedString(hasNext)).append("\n");
172     sb.append("    hasPrevious: ").append(toIndentedString(hasPrevious)).append("\n");
173     sb.append("}");
174     return sb.toString();
175   }
176 
177   /**
178    * Convert the given object to string with each line indented by 4 spaces
179    * (except the first line).
180    */
181   private String toIndentedString(Object o) {
182     if (o == null) {
183       return "null";
184     }
185     return o.toString().replace("\n", "\n    ");
186   }
187 }