"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DueDateField = void 0;
var react_1 = __importDefault(require("react"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var classnames_1 = __importDefault(require("classnames"));
var ramda_1 = require("ramda");
var useWorkflowDueDate_1 = require("../hooks/useWorkflowDueDate");
var DateEditor_1 = require("../../../DateEditor");
var styles_1 = require("./styles");
var DueDateField = function (_a) {
    var taskId = _a.taskId, dueDate = _a.dueDate, isTaskOpen = _a.isTaskOpen, className = _a.className;
    var styles = (0, styles_1.useStyles)();
    var _b = (0, useWorkflowDueDate_1.useWorkflowDueDate)({
        dueDate: dueDate,
        taskId: taskId,
        isOpen: isTaskOpen
    }), updateDueDate = _b.updateDueDate, updateRequestIsInProgress = _b.updateRequestIsInProgress, readOnly = _b.readOnly;
    return (react_1.default.createElement(DateEditor_1.DateEditor, { disabled: updateRequestIsInProgress || readOnly, value: dueDate, label: ui_i18n_1.default.text('Due date'), onChange: (0, ramda_1.pipe)(function (date) { return date && date.getTime(); }, updateDueDate), slotProps: {
            textField: {
                className: (0, classnames_1.default)(styles.dueDate, className),
                size: 'small',
                InputProps: { className: styles.dueDateInput },
                InputLabelProps: {
                    classes: { root: styles.inputLabel }
                }
            }
        } }));
};
exports.DueDateField = DueDateField;
