// Path: src/main/java/com/github/kislayverma/rulette/rest/model/PaginatedResult.java
// public class PaginatedResult<T> implements Serializable {
//     private List<T> data;
//     private int pageNum;
//     private int pageSize;
//     private int totalRecordCount;
//     private boolean hasNext;
//     private boolean hasPrev;
// 
//     public PaginatedResult() {
//     }
// 
//     public PaginatedResult(List<T> rules, int pageNum, int pageSize, int totalRecordCount, boolean hasNext, boolean hasPrev) {
//         this.data = rules;
//         this.pageNum = pageNum;
//         this.pageSize = pageSize;
//         this.totalRecordCount = totalRecordCount;
//         this.hasNext = hasNext;
//         this.hasPrev = hasPrev;
//     }
// 
//     public List<T> getData() {
//         return data;
//     }
// 
//     public int getPageNum() {
//         return pageNum;
//     }
// 
//     public int getPageSize() {
//         return pageSize;
//     }
// 
//     public boolean isHasNext() {
//         return hasNext;
//     }
// 
//     public boolean isHasPrev() {
//         return hasPrev;
//     }
// 
//     public int getTotalRecordCount() {
//         return totalRecordCount;
//     }
// }


import com.github.kislayverma.rulette.rest.model.PaginatedResult;
import java.util.List;
package com.github.kislayverma.rulette.rest.utils;



public class PaginationUtil {
    /**
     * This method returns sublists of the given list in a paginated way
     * @param data The complete subparts of which are to be returned as pages
     * @param pageNum The number of the page to be returned
     * @param pageSize The number of records in each page
     * @param <T> The data type of the input list
     * @return A paginated result build as per input page size and page number
     */
    public static <T> PaginatedResult<T> getPaginatedData(List<T> data, int pageNum, int pageSize) {
        int startingIndex = (pageNum - 1) * pageSize;
        if (startingIndex >= data.size() || startingIndex < 0) {
// Path: src/main/java/com/github/kislayverma/rulette/rest/model/PaginatedResult.java
// public class PaginatedResult<T> implements Serializable {
//     private List<T> data;
//     private int pageNum;
//     private int pageSize;
//     private int totalRecordCount;
//     private boolean hasNext;
//     private boolean hasPrev;
// 
//     public PaginatedResult() {
//     }
// 
//     public PaginatedResult(List<T> rules, int pageNum, int pageSize, int totalRecordCount, boolean hasNext, boolean hasPrev) {
//         this.data = rules;
//         this.pageNum = pageNum;
//         this.pageSize = pageSize;
//         this.totalRecordCount = totalRecordCount;
//         this.hasNext = hasNext;
//         this.hasPrev = hasPrev;
//     }
// 
//     public List<T> getData() {
//         return data;
//     }
// 
//     public int getPageNum() {
//         return pageNum;
//     }
// 
//     public int getPageSize() {
//         return pageSize;
//     }
// 
//     public boolean isHasNext() {
//         return hasNext;
//     }
// 
//     public boolean isHasPrev() {
//         return hasPrev;
//     }
// 
//     public int getTotalRecordCount() {
//         return totalRecordCount;
//     }
// }


// Path: src/main/java/com/github/kislayverma/rulette/rest/utils/PaginationUtil.java
import com.github.kislayverma.rulette.rest.model.PaginatedResult;
import java.util.List;

package com.github.kislayverma.rulette.rest.utils;



public class PaginationUtil {
    /**
     * This method returns sublists of the given list in a paginated way
     * @param data The complete subparts of which are to be returned as pages
     * @param pageNum The number of the page to be returned
     * @param pageSize The number of records in each page
     * @param <T> The data type of the input list
     * @return A paginated result build as per input page size and page number
     */
    public static <T> PaginatedResult<T> getPaginatedData(List<T> data, int pageNum, int pageSize) {
        int startingIndex = (pageNum - 1) * pageSize;
        if (startingIndex >= data.size() || startingIndex < 0) {
            return new PaginatedResult<>(null, pageNum, pageSize, data.size(), false, true);