package com.adealink.weparty.util

class PageHandler(private val initialPage: String = "", val pageSize: Int = 20) {

    var currentPage: String? = initialPage
        private set

    var isEnd: Boolean = false

    fun reset() {
        currentPage = initialPage
        isEnd = false
    }

    fun nextPage(next: String?) {
        if (next.isNullOrEmpty()) {
            isEnd = true
        }
        if (isEnd) {
            return
        }
        currentPage = next
    }

    fun isFirstPage(): Boolean = currentPage == null
}