/// class PD.Manage.Modules.Rules.UploadZipDialogCommand

PD.Manage.Modules.Rules.UploadZipDialogCommand =
PD.Commands.Command.extend({

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

    setDefaults: function () {

        this.props("id", this.inits("id") || "package/upload-dialog");
        this.props("enabled", true);
        this.props("label", "Upload Zip");
        this.props("icon", PD.Path.to16x16("folder_zip_up.png"));
        this.props("tooltip", "");
        this.props("canExecute", true);

    },

    setState: function (state) {
        this._super(state);
        this.props("enabled", this.props("canExecute"));
    },

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

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

    _executeServiceCall: function () {

        PD.Manage.Modules.Rules.UploadZipDialog.open({
            callbacks: {
                ok: function (e) {

                    setTimeout(function () {
                        e.close();
                        PD.context.get_default().get_events().publish("rule-script/update");
                    }, 1000)

                }
            }
        });

    },

    _enabledAndCanExecute: function (value) {
        this.props("enabled", value);
        this.props("canExecute", value);
    }

});