/// class PD.Manage.Services.RulesService

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

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

    saveRuleScript: function (id, content, success, error) {

        PD.ajax({
            type: "POST",
            url: PD.Path.resolve("~/Manage/Rules/SaveRuleScript"),
            data: {
                id: id,
                content: content
            },
            success: function (e) {
                if (success) {
                    success(e);
                }
            },
            error: error
        });

    },

    getPackage: function (success, error) {

        PD.Web.Utilities.DownloadManager.download("~/Manage/Rules/GetPackage", {
            folderId: folderId
        });

    },

    addPackage: function (uploadId, success, error) {

        PD.ajax({
            type: "POST",
            url: PD.Path.resolve("~/Manage/Rules/AddPackage"),
            data: {
                uploadId: uploadId
            },
            success: success || success,
            error: error
        });

    },

    deleteRuleScript: function (id, success, error) {

        PD.ajax({
            type: "DELETE",
            url: PD.Path.resolve("~/Manage/Rules/DeleteRuleScript"),
            data: {
                id: id
            },
            success: function (e) {
                if (success) {
                    success(e);
                }
            },
            error: error
        });

    }

});