text: /*
    REST API library for /logs route.
  */
  
  // Public npm libraries.
  const Router = require('koa-router')
  
  // Local libraries.
  const LogsRESTControllerLib = require('./controller')
  
  class LogsRouter {
    constructor (localConfig = {}) {
      // Dependency Injection.
      this.adapters = localConfig.adapters
      if (!this.adapters) {
        throw new Error(
          'Instance of Adapters library required when instantiating Logs REST Controller.'
        )
      }
      this.useCases = localConfig.useCases
      if (!this.useCases) {
        throw new Error(
          'Instance of Use Cases library required when instantiating Logs REST Controller.'
        )
      }
  
      const dependencies = {
        adapters: this.adapters,
        useCases: this.useCases
      }
  
      this.logsRESTController = new LogsRESTControllerLib(dependencies)
  
      // Instantiate the router and set the base route.
      const baseUrl = '/logs'
      this.router = new Router({ prefix: baseUrl })
    }
  
    attach (app) {
      if (!app) {
        throw new Error(
          'Must pass app object when attaching REST API controllers.'
        )
      }
  
      // Define the routes and attach the controller.
      this.router.post('/', this.logsRESTController.getLogs)
  
      // Attach the Controller routes to the Koa app.
      app.use(this.router.routes())
      app.use(this.router.allowedMethods())
    }
  }
  
  module.exports = LogsRouter
  