'use strict';

const useMulti = require('./selection/useMulti.cjs');
const useRange = require('./selection/useRange.cjs');
const useSingle = require('./selection/useSingle.cjs');

/**
 * Determines the appropriate selection hook to use based on the selection mode
 * and returns the corresponding selection object.
 *
 * @template T - The type of DayPicker props.
 * @param props - The DayPicker props.
 * @param dateLib - The date utility library instance.
 * @returns The selection object for the specified mode, or `undefined` if no
 *   mode is set.
 */
function useSelection(props, dateLib) {
    const single = useSingle.useSingle(props, dateLib);
    const multi = useMulti.useMulti(props, dateLib);
    const range = useRange.useRange(props, dateLib);
    switch (props.mode) {
        case "single":
            return single;
        case "multiple":
            return multi;
        case "range":
            return range;
        default:
            return undefined;
    }
}

exports.useSelection = useSelection;
