/// class PD.Manage.Modules.ReportDownloadTemplateCommand

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

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

    setDefaults: function () {
        this.props("id", "report/download-template");
        this.props("enabled", false);
        this.props("icon", PD.Path.to16x16("cloud_download.png"));
        this.props("label", "Download Template");
        this.props("tooltip", "Download the template associated<br/>with the selected Report.");
        this.state("report", null);
    },

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

    execute: function (e) {
        this._super(e);

        var report = this.state("report");

        PD.Web.Utilities.DownloadManager.download("~/Manage/Report/Download/" + report.id);

    },

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

    _isEnabled: function () {
        return this.state("report") != null
            && this.state("report").id != null;
    }

});