/// class PD.Manage.Services.ExplorerModelService

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

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

    getFolders: function (entityTypeId, folderId, success) {

        PD.ajax({
            url: PD.Path.resolve("~/explorermodel/getfolders"),
            data: {
                entityTypeId: entityTypeId,
                folderId: folderId
            },
            success: function (e) {
                if (success) {
                    success(e);
                }
            }
        });

    },

    deleteFolder: function (folderId, success) {

        PD.ajax({
            type: "POST",
            url: ProspectDirector.RUNTIME.resolveUrl("~/explorerfolder/delete?id=" + folderId),
            success: function (e) {
                if (success) {
                    success(folderId);
                }
            }
        });

    },

    addFolder: function (parentId, formTypeId, success) {
    
        PD.ajax({
            type: "POST",
            url: PD.Path.resolve("~/explorerfolder/new"),
            data: {
                parentFolderId: parentId,
                formTypeId: formTypeId
            },
            success: function (data) {
                success({
                    parentId: parentId,
                    node: data
                });
            }
        });
    
    },

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


    },

});