namespace uniflash.ds {

    export class AgentInstallDialog {

        static $inject = ['$uibModal', 'ufSession'];

        constructor(private uibModal: angular.ui.bootstrap.IModalService,
            private ufSession: uniflash.session.SessionService) {
        }

        show(installWizardObj) {

            function AgentInstallDialogController() {

                var vm = this;
                vm.wizardObj = installWizardObj;

                // treat the finish step as a normal install step
                vm.wizardObj.steps.push(vm.wizardObj.finishStep);

                vm.getActionButtonText = function(action) {
                    return action.text.split('$');
                };

                vm.cancelClicked = function($dismiss) {
                    $dismiss(new ti_common.CancelError('Cloud Agent Installation Canceled.'));
                };

            }

            var modalInstance = this.uibModal.open({
                templateUrl: 'ds/agent_install_dialog.html',
                controllerAs: 'vm',
                controller: AgentInstallDialogController
            });

            return modalInstance.result;
        }
    }

    angular.module('uniflash').service('ufAgentInstallDialog', AgentInstallDialog);

}