/// class PD.Manage.Services.ProcessModelService

PD.Manage.Services.ProcessModelService =
Class.extend({

    //===================================
    // PUBLIC METHODS
    //===================================

    getNodes: function (processId, nodeType, nodeId, success) {

        PD.ajax({
            url: PD.Path.resolve("~/manage/process/getnodes"),
            data: {
                processId: processId,
                nodeType: nodeType,
                nodeId: nodeId
            },
            success: function (e) {
                if (success) {
                    success(e);
                }
            }
        });

    },

    deleteNode: function (nodeId, success) {

        PD.ajax({
            type: "POST",
            url: Jade.Path.resolve("~/manage/processnode/delete/" + nodeId),
            success: function (e) {
                if (success) {
                    success(nodeId);
                }
            }
        });

    },

    addNode: function (processId, parentId, success) {
    
        PD.ajax({
            type: "POST",
            url: PD.Path.resolve("~/processnode/new"),
            data: {
                parentId: parentId,
                parentType: null,
                processId: processId
            },
            success: function (data) {
                success({
                    parentId: parentId,
                    node: data
                });
            }
        });
    
    },

    moveNode: function (sourceId, destinationId, dropType, success) {
        
        PD.ajax({
            type: "POST",
            url: PD.Path.resolve("~/processnode/move"),
            data: {
                sourceId: sourceId,
                destinationId: destinationId,
                dropType: dropType
            },
            success: function (data) {
                success(data);
            }
        });
        
    },

});