export interface IListResponse_DTO<T> {
  page: number;
  per_page: number;
  total_pages: number;
  total_items: number;
  items: T[];
}

export const IsResponseAListDTO = <T>(
  response: any
): response is IListResponse_DTO<T> => {
  return (
    typeof response === "object" &&
    response !== null &&
    response.hasOwnProperty("total_items")
  );
};

export const existsMoreReponsePages = <T>(
  response: any
): response is IListResponse_DTO<T> => {
  return (
    IsResponseAListDTO(response) && response.page + 1 < response.total_pages
  );
};
