package io.github.miroslavpokorny.blog.model.helper;

import java.util.List;

public class PaginationHelper <T> {
    private long total;

    private int page;

    private int itemsPerPage;

    private List<T> items;

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }

    public int getItemsPerPage() {
        return itemsPerPage;
    }

    public void setItemsPerPage(int itemsPerPage) {
        this.itemsPerPage = itemsPerPage;
    }

    public int getNumberOfPages() {
        return (int) Math.ceil(total / (float) itemsPerPage);
    }
}
