const express = require("express");
const router = express.Router();
const authorize = require("../../../../middlewares/authorize-sapps");
const shiftTypeService = require("./shiftType.service.clockReminder");

/**
 * Get shift types for clock reminder with Ramadan detection
 * Returns shift types with their effective times based on current date or specified date
 */
router.post('/clock-reminder-options', authorize(), getClockReminderOptions);

module.exports = router;

/**
 * Get shift types for clock reminder settings
 * Includes Ramadan period detection and effective times
 * 
 * @param {Object} req.body - Request body
 * @param {number} req.body.company_id - Company ID
 * @param {string} [req.body.date] - Optional date (YYYY-MM-DD) for preview
 * @returns {Object} - Shift types with Ramadan info
 */
function getClockReminderOptions(req, res, next) {
    shiftTypeService
        .getClockReminderOptions(req.body)
        .then((result) => res.json(result))
        .catch(next);
}
