import ModalBase from 'ember-cli-dunlop/mixins/modal-base'
export default ModalBase.extend
  project_users: Ember.A()
  possible_users: []
  possible_workflow_instance_types: []
  willOpenModal: ->
    @set 'possible_users', @store.peekAll('user')
    @set 'possible_workflow_instance_types', @store.peekAll('panda/workflow-instance-type')
    @get('model.users').then (users)=>
      @set 'project_users', users.toArray()
    #@set 'project_users', @get('model.users').toArray()

  actions:
    saveRecord: ->
      @set('model.users', @get('project_users'))
      @_super()

    selectWorkflowInstanceType: (workflow_instance_type) ->
      @set 'model.workflow_instance_type', workflow_instance_type
    newProjectScenario: ->
      record = @store.createRecord 'panda/project-scenario', project: @get('model')
      @modal 'project/edit-project-scenario',
        model: record
        title: t('action.new_model', model: t('models.project_scenario'))

