/**
 * DevExtreme (ui/scheduler/workspaces/utils.work_week.js)
 * Version: 20.2.0 (build 20182-0310)
 * Build date: Tue Jun 30 2020
 *
 * Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
var _date = require("../../../core/utils/date");
var _date2 = _interopRequireDefault(_date);

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        "default": obj
    }
}

function _classCallCheck(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function")
    }
}

function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) {
            descriptor.writable = true
        }
        Object.defineProperty(target, descriptor.key, descriptor)
    }
}

function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) {
        _defineProperties(Constructor.prototype, protoProps)
    }
    if (staticProps) {
        _defineProperties(Constructor, staticProps)
    }
    return Constructor
}
var MONDAY_INDEX = 1;
var SATURDAY_INDEX = 6;
var SUNDAY_INDEX = 0;
var workWeekUtils = function() {
    function workWeekUtils() {
        _classCallCheck(this, workWeekUtils)
    }
    _createClass(workWeekUtils, null, [{
        key: "isDataOnWeekend",
        value: function(date) {
            var day = date.getDay();
            return day === SATURDAY_INDEX || day === SUNDAY_INDEX
        }
    }, {
        key: "getFirstDayOfWeek",
        value: function(firstDayOfWeekOption) {
            return firstDayOfWeekOption || MONDAY_INDEX
        }
    }, {
        key: "getWeekendsCount",
        value: function(days) {
            return 2 * Math.floor(days / 7)
        }
    }, {
        key: "getFirstViewDate",
        value: function(viewStart, firstDayOfWeek) {
            var firstViewDate = _date2.default.getFirstWeekDate(viewStart, firstDayOfWeek);
            return _date2.default.normalizeDateByWeek(firstViewDate, viewStart)
        }
    }]);
    return workWeekUtils
}();
module.exports = workWeekUtils;
