namespace adas_core.Domain.Models.Responses; /// /// Represents a generic response wrapper for paginated data, typically used to return a subset of items along with associated pagination metadata. /// /// The type of the items contained in the paginated response. /// public class PaginationResponse { /// /// Initializes a new instance of with the supplied page items and pagination metadata, deriving the total page count from and . /// /// The of items included in the current page. /// The number of the current page. /// The maximum number of items per page. /// The total number of records available across all pages. /// public PaginationResponse(List data, int pageNumber, int pageSize, long totalRecords) { PageNumber = pageNumber; PageSize = pageSize; Data = data; TotalRecords = totalRecords; var totalPages = TotalRecords / (double)PageSize; var roundedTotalPages = Convert.ToInt64(Math.Ceiling(totalPages)); TotalPages = roundedTotalPages; } public int PageNumber { get; set; } public int PageSize { get; set; } public long TotalPages { get; set; } public long TotalRecords { get; set; } public List Data { get; set; } }