/**
 * DevExtreme (cjs/ui/gantt/ui.gantt.model_changes_listener.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.ModelChangesListener = void 0;
const GANTT_TASKS = "tasks";
const GANTT_DEPENDENCIES = "dependencies";
const GANTT_RESOURCES = "resources";
const GANTT_RESOURCE_ASSIGNMENTS = "resourceAssignments";
const ModelChangesListener = {
    create: gantt => ({
        NotifyTaskCreated: (task, callback, errorCallback) => {
            gantt._onRecordInserted("tasks", task, callback)
        },
        NotifyTaskRemoved: (taskId, errorCallback, task) => {
            gantt._onRecordRemoved("tasks", taskId, task)
        },
        NotifyTaskUpdated: (taskId, newValues, errorCallback) => {
            gantt._onRecordUpdated("tasks", taskId, newValues)
        },
        NotifyParentTaskUpdated: (task, errorCallback) => {
            gantt._onParentTaskUpdated(task)
        },
        NotifyDependencyInserted: (dependency, callback, errorCallback) => {
            gantt._onRecordInserted("dependencies", dependency, callback)
        },
        NotifyDependencyRemoved: (dependencyId, errorCallback, dependency) => {
            gantt._onRecordRemoved("dependencies", dependencyId, dependency)
        },
        NotifyResourceCreated: (resource, callback, errorCallback) => {
            gantt._onRecordInserted("resources", resource, callback)
        },
        NotifyResourceRemoved: (resourceId, errorCallback, resource) => {
            gantt._onRecordRemoved("resources", resourceId, resource)
        },
        NotifyResourceAssigned: (assignment, callback, errorCallback) => {
            gantt._onRecordInserted("resourceAssignments", assignment, callback)
        },
        NotifyResourceUnassigned: (assignmentId, errorCallback, assignment) => {
            gantt._onRecordRemoved("resourceAssignments", assignmentId, assignment)
        },
        NotifyParentDataRecalculated: data => {
            gantt._onParentTasksRecalculated(data)
        },
        NotifyTaskCreating: args => {
            gantt._actionsManager.raiseInsertingAction("tasks", args)
        },
        NotifyTaskRemoving: args => {
            gantt._actionsManager.raiseDeletingAction("tasks", args)
        },
        NotifyTaskUpdating: args => {
            gantt._actionsManager.raiseUpdatingAction("tasks", args)
        },
        NotifyTaskMoving: args => {
            gantt._actionsManager.raiseUpdatingAction("tasks", args, gantt._actionsManager.getTaskMovingAction())
        },
        NotifyTaskEditDialogShowing: args => {
            gantt._actionsManager.raiseTaskEditDialogShowingAction(args)
        },
        NotifyResourceManagerDialogShowing: args => {
            gantt._actionsManager.raiseResourceManagerDialogShowingAction(args)
        },
        NotifyDependencyInserting: args => {
            gantt._actionsManager.raiseInsertingAction("dependencies", args)
        },
        NotifyDependencyRemoving: args => {
            gantt._actionsManager.raiseDeletingAction("dependencies", args)
        },
        NotifyResourceCreating: args => {
            gantt._actionsManager.raiseInsertingAction("resources", args)
        },
        NotifyResourceRemoving: args => {
            gantt._actionsManager.raiseDeletingAction("resources", args)
        },
        NotifyResourceAssigning: args => {
            gantt._actionsManager.raiseInsertingAction("resourceAssignments", args)
        },
        NotifyResourceUnassigning: args => {
            gantt._actionsManager.raiseDeletingAction("resourceAssignments", args)
        },
        NotifyScaleCellPrepared: args => {
            gantt._actionsManager.raiseScaleCellPreparedAction(args)
        },
        NotifyGanttViewUpdated: () => {
            gantt._onGanttViewCoreUpdated()
        }
    })
};
exports.ModelChangesListener = ModelChangesListener;
