const { addMinutes, format, parse } = require('date-fns');

function calculateStagger(baseTime, interval, servers) {
    const start = parse(baseTime, 'HH:mm:ss', new Date());
    
    return servers.map((server, index) => ({
        ...server,
        effective_time: format(addMinutes(start, index * interval), 'HH:mm:ss')
    }));
}

module.exports = { calculateStagger };
