/// class PD.Manage.Services.ProcessModelService

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

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

    getNodes: function (processId, nodeId, success) {

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

    },

    deleteNode: function (nodeId, success) {

        PD.ajax({
            type: "POST",
            url: ProspectDirector.RUNTIME.resolveUrl("~/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,
                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);
            }
        });
        
    },

});