/// class PD.Manage.Modules.SystemSettingClearCacheCommand

PD.Manage.Modules.SystemSettingClearCacheCommand =
PD.Commands.Command.extend({

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

    setDefaults: function (options) {

        this.props("id", "system-setting/clear-cache");
        this.props("enabled", true);
        this.props("label", "Clear Cache");
        this.props("icon", PD.Path.to16x16("arrow_circle2.png"));
        this.props("tooltip", "Clear the Query Palette Cache.");

    },

    execute: function (e) {
        this._super(e);
        this._showConfirmationDialog();
    },

    //===================================
    // PRIVATE METHODS
    //===================================

    _showConfirmationDialog: function () {

        ProspectDirector.Web.UI.MessageDialog.confirm({
            title: "Clear Cache?",
            message: "Clear the palette cache?",
            buttons: {
                ok: {
                    label: "OK",
                    callback: _.bind(this._execute, this)
                },
                cancel: {
                    label: "Cancel"
                }
            }
        });

    },

    _execute: function () {

        PD.ajax({
            type: "POST",
            url: PD.Path.resolve("~/Manage/Settings/ClearCache"),
            success: function () {

                ProspectDirector.Web.UI.MessageDialog.notify({
                    title: "Cache Cleared",
                    message: "The palette cache has been cleared successfully."
                });

            }
        })

    }

});
