package ru.micord.ervu_dashboard.service;


import java.sql.Timestamp;

import ru.micord.ervu_dashboard.dao.DataDateDao;
import org.springframework.stereotype.Service;
import ru.micord.ervu_dashboard.util.DateUtils;

/**
 * @author Alexandr Shalaginov
 */
@Service
public class DataDateService {

  private final DataDateDao dataDateDao;

  public DataDateService(DataDateDao dataDateDao) {
    this.dataDateDao = dataDateDao;
  }

  public String getDataDate(String clientTimeZone) {
    Timestamp lastRecordingDate = dataDateDao.getLastRecordingDate();
    String formattedClientDate = DateUtils.formatTimestampWithClientZone(lastRecordingDate, clientTimeZone);
    return "Данные на " + formattedClientDate + " г.";
  }
}
