const log = require('electron-log');

const getContentItemIndex = (item, currentHours) => {
    try {
        let index = -1;
        let lastTime = -1;

        for ( let i = 0; i < item.start_time.length; i++ ) {
            if ( item.start_time[i] <= currentHours && item.start_time[i] > lastTime ) {
                index = i;
                lastTime = item.start_time[i];
            }
        }

        return index;
    } catch (e) {
        log.error('getStartBlocksTime() -> getContentItemIndex()', e);
    }
};

module.exports = getContentItemIndex;
