package com.tasteby.service;

import com.tasteby.domain.SiteVisitStats;
import com.tasteby.mapper.StatsMapper;
import org.springframework.stereotype.Service;

@Service
public class StatsService {

    private final StatsMapper mapper;

    public StatsService(StatsMapper mapper) {
        this.mapper = mapper;
    }

    public void recordVisit() {
        mapper.recordVisit();
    }

    public SiteVisitStats getVisits() {
        return SiteVisitStats.builder()
                .today(mapper.getTodayVisits())
                .total(mapper.getTotalVisits())
                .build();
    }
}
