/// class PD.Manage.Modules.ObjectModel.ProcessPropertiesDialogCommand

PD.Manage.Modules.ObjectModel.ProcessPropertiesDialogCommand =
PD.Commands.Command.extend({

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

    setDefaults: function () {

        this.props("id", "process/properties-dialog");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("pencil.png"));
        this.props("label", "Edit");
        this.props("tooltip", "Edit the selected Process.");

        this.state("processId", null);

    },

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

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

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

    _showDialog: function (processId) {


        PDJS.Shared.Features.FeatureDialogForNhib.open({
            title: "Process",
            args: {
                targetId: processId,
                targetType: "ProspectDirector.Web.Shared.Modules.Process.ProcessUIO",
                arbiterType: "ProspectDirector.Web.Manage.Modules.Process.ProcessArbiter"
            },
            callbacks: {
                "ok": (sender, data) => {
                    PD.context
                        .get_default()
                        .get_events()
                        .publish("process/update", {
                            id: e.id
                        });
                }
            }
        });

    }

});