/// class PD.Manage.Modules.Rules.RuleScriptPropertiesDialogCommand
// using PD.Commands.Command

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

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

    setDefaults: function () {

        this.props("id", "rule-script/properties-dialog");
        this.props("enabled", false);
        this.props("icon", PD.Path.to16x16("pencil.png"));
        this.props("label", "Edit");
        this.props("tooltip", "Edit the properties of the selected Rule Script.");

        this.state("rulescript", null);

    },

    setState: function (e) {
        this._super(e);
        this.props("enabled", this.state("rulescript") != null);
    },

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

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

    _showDialog: function () {

        var ruleScript = this.state("rulescript");

        ProspectDirector.Web.UI.FeatureSets.NHibTargetEditorDialog.open({
            config: {
                title: "Rule Script Properties",
                height: "400px",
                width: "450px"
            },
            data: {
                targetArbiter: "ProspectDirector.Web.Manage.Modules.Rules.RuleScriptArbiter",
                targetType: "ProspectDirector.Web.Manage.Modules.Rules.RuleScriptUIO",
                targetId: ruleScript.id,
                layoutType: ProspectDirector.Web.UI.FeatureSets.Layouts.TabStripLayout
            },
            callbacks: {
                ok: function (sender, e) {
                    PD.context.get_default().get_events().publish("rule-script/update");
                }
            }
        });

    }

});