/**
 * DevExtreme (cjs/renovation/ui/scheduler/appointment/utils/getAppointmentTakesAllDay.js)
 * Version: 23.2.4 (build 24056-0112)
 * Build date: Sun Feb 25 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.getAppointmentTakesAllDay = void 0;
var _type = require("../../../../../core/utils/type");
var _date = _interopRequireDefault(require("../../../../../core/utils/date"));

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
const toMs = _date.default.dateToMilliseconds;
const DAY_HOURS = 24;
const getDurationInHours = (startDate, endDate) => Math.floor((endDate.getTime() - startDate.getTime()) / toMs("hour"));
const getAppointmentTakesAllDay = (appointmentAdapter, allDayPanelMode) => {
    const {
        allDay: allDay,
        endDate: endDate,
        startDate: startDate
    } = appointmentAdapter;
    switch (allDayPanelMode) {
        case "hidden":
            return false;
        case "allDay":
            return allDay;
        case "all":
        default:
            if (allDay) {
                return true
            }
            if (!(0, _type.isDefined)(endDate)) {
                return false
            }
            return getDurationInHours(startDate, endDate) >= 24
    }
};
exports.getAppointmentTakesAllDay = getAppointmentTakesAllDay;
