package com.betriebsratkanzlei.legalconsenthub.notification

import com.betriebsratkanzlei.legalconsenthub_api.model.PagedNotificationDto
import org.springframework.data.domain.Page
import org.springframework.stereotype.Component

@Component
class PagedNotificationMapper(
    private val notificationMapper: NotificationMapper
) {

    fun toPagedNotificationDto(page: Page<Notification>): PagedNotificationDto {
        return PagedNotificationDto(
            content = page.content.map { notificationMapper.toNotificationDto(it) },
            number = page.number,
            propertySize = page.size,
            numberOfElements = page.numberOfElements,
            totalElements = page.totalElements,
            totalPages = page.totalPages,
            first = page.isFirst,
            last = page.isLast,
            empty = page.isEmpty
        )
    }
} 