-###*
-* @name Remote
-* @module Remote
-* @description
-*
-* Remotes let you remotely use Contexts
-###
 class Remote
+
+  @ALLOWED_RPC_OPERATIONS: [
+    'command'
+    'query'
+    'findAllDomainEvents'
+    'findDomainEventsByName'
+    'findDomainEventsByAggregateId'
+    'findDomainEventsByAggregateName'
+    'findDomainEventsByNameAndAggregateId'
+  ]
 
   constructor: (@_contextName, @_eventric) ->
     @name = @_contextName

      params: Array.prototype.slice.call params


  ###*
  * @name addClient
  * @module Remote
  * @description Add a RemoteClient
  *
  * @param {String} clientName Name of the Client
  * @param {Object} client Object containing an initialized Client
  ###
  addClient: (clientName, client) ->
    @_clients[clientName] = client
    @


  ###*
  * @name getClient
  * @module Remote
  * @description Get a RemoteClient
  *
  * @param {String} clientName Name of the Client
  ###
  getClient: (clientName) ->
    @_clients[clientName]


  ###*
  * @name addProjection
  * @module Remote
  * @description Add Projection that can subscribe to and handle DomainEvents
  *
  * @param {string} projectionName Name of the Projection
  * @param {Function} The Projection Class definition
  ###
  addProjection: (projectionName, projectionClass) ->
    @_projectionClasses[projectionName] = projectionClass
    @


  ###*
  * @name initializeProjection
  * @module Remote
  * @description Initialize a Projection based on an Object
  *
  * @param {Object} projectionObject Projection Object
  * @param {Object} params Object containing Projection Parameters
  ###
  initializeProjection: (projectionObject, params) ->
    @projectionService.initializeInstance '', projectionObject, params, @


  ###*
  * @name initializeProjectionInstance
  * @module Remote
  * @description Initialize a ProjectionInstance
  *
  * @param {String} projectionId ProjectionId
  * @param {Object} params Object containing Projection Parameters
  ###
  initializeProjectionInstance: (projectionName, params) ->
    if not @_projectionClasses[projectionName]
      err = "Given projection #{projectionName} not registered on remote"

    @projectionService.initializeInstance projectionName, @_projectionClasses[projectionName], params, @


  getProjectionInstance: (projectionId) ->
    @projectionService.getInstance projectionId


  destroyProjectionInstance: (projectionId) ->
    @projectionService.destroyInstance projectionId, @
