/**
 * static resource provider router
 * @author tala
 */

'use strict'

const express = require('express');
const path = require('path');

class StaticResourceProvider {
  constructor(policyRouter) {
    this._policyRouter = policyRouter
  }

  static get ONE_YEAR() {
    return 365 * 24 * 60 * 60 * 1000;
  }

  init() {
    let self = this


    self._policyRouter.use('/', express.static(path.join(__dirname, '../dist'), {
      maxAge: StaticResourceProvider.ONE_YEAR
    }), {
      name: 'static.dist'
    });

    return self
  }
}

module.exports = StaticResourceProvider
