package com.attensa.rubberband.data;

import lombok.Value;
import org.jooq.lambda.Seq;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

import static org.jooq.lambda.Seq.seq;

@Value
public class Page<T> {
    List<T> contents;
    PageRequest request;
    long total;

    //here until a better api can be figured out.
    Map<String, Object> aggregations;

    public <S> Page<S> map(Function<T, S> conversion) {
        return new Page<>(seq(contents).map(conversion).toList(), request, total, aggregations);
    }
}

@@ -49,41 +49,47 @@
 bok.
-Value;%0Aimport org.jooq.lambda.Seq
+AllArgsConstructor;%0Aimport lombok.Value
 ;%0A%0Ai
@@ -216,16 +216,36 @@
 %0A@Value%0A
+@AllArgsConstructor%0A
 public c
@@ -373,16 +373,16 @@
 ed out.%0A
-
     Map%3C
@@ -412,16 +412,138 @@
 tions;%0A%0A
+    public Page(List%3CT%3E contents, PageRequest request, long total) %7B%0A        this(contents, request, total, null);%0A    %7D%0A%0A
     publ

add an alternate constructor for existing clients