/// class PD.Manage.Modules.SelectionListEditDialogCommand

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

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

    setDefaults: function () {

        this.props("id", "selection-list/properties-dialog");
        this.props("icon", PD.Path.to16x16("pencil.png"));
        this.props("label", "Edit");
        this.props("tooltip", "Edit the selected Selection List.");
        this.state("selectionList", null);

    },

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

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

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

        PDJS.Shared.Features.FeatureDialogForNhib.open({
            title: "Edit Selection List - " + selectionList.name,
            height: "450px",
            width: "450px",
            args: {
                targetId: selectionList.id,
                targetType: "ProspectDirector.Web.Manage.Modules.Extensions.SelectionListUIO",
                arbiterType: "ProspectDirector.Web.Manage.Modules.Extensions.SelectionListArbiter"
            },
            callbacks: {
                "ok": (sender, e) => {

                    PD.context
                        .get_default()
                        .get_events()
                        .publish("selection-list/edit", selectionList);

                }
            }
        });

    },

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

});