/// class PD.Manage.Modules.EventDialogCommand

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

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

    setDefaults: function () {
        this.props("id", "event/view-dialog");
        this.props("enabled", false);
        this.props("icon", PD.Path.resolve("~/application/icons/16x16/MAGNIFYING_GLASS.png"));
        this.props("label", "Details");
        this.props("tooltip", "View details for the selected event.");
        this.state("event", null);
    },

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

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

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

        this._showDialog(event.id);

    },

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

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

    _showDialog: function (id) {

        ProspectDirector.Web.UI.FeatureSets.NHibTargetEditorDialog.open({
            config: {
                title: "Event Log Entry"
            },
            data: {
                targetArbiter: "ProspectDirector.Web.Manage.Modules.Events.EventArbiter",
                targetType: "ProspectDirector.Web.Manage.Modules.Events.EventUIO",
                layoutType: ProspectDirector.Web.UI.FeatureSets.Layouts.TabStripLayout,
                targetId: id
            }
        });

    }

});