package com.unicorn.hgzero.meeting.biz.service;

import com.unicorn.hgzero.meeting.biz.domain.Dashboard;
import com.unicorn.hgzero.meeting.biz.usecase.in.dashboard.GetDashboardUseCase;
import com.unicorn.hgzero.meeting.biz.usecase.out.DashboardReader;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 대시보드 Service
 * Dashboard 관련 모든 UseCase 구현
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DashboardService implements GetDashboardUseCase {

    private final DashboardReader dashboardReader;

    /**
     * 사용자 대시보드 조회
     */
    @Override
    @Transactional(readOnly = true)
    public Dashboard getDashboard(String userId) {
        log.debug("Getting dashboard for user: {}", userId);

        return dashboardReader.getDashboardByUserId(userId);
    }

    /**
     * 사용자 대시보드 (기간 필터) 조회
     */
    @Override
    @Transactional(readOnly = true)
    public Dashboard getDashboardByPeriod(String userId, String period) {
        log.debug("Getting dashboard for user: {} with period: {}", userId, period);

        return dashboardReader.getDashboardByUserIdAndPeriod(userId, period);
    }
}
