package app.mealsmadeeasy.api.sliceview;

import org.springframework.data.domain.Slice;
import org.springframework.stereotype.Service;

@Service
public class SliceViewService {

    public <T> SliceView<T> getSliceView(Slice<T> slice) {
        final SliceView.SliceViewMeta meta = new SliceView.SliceViewMeta(
                slice.getSize(),
                slice.getNumber(),
                slice.hasNext()
        );
        return new SliceView<>(slice.getContent(), meta);
    }

}
