<?php
use Psr\Container\ContainerInterface as Container;
use Carbon\Carbon;

return [
  'urls' => function(Container $c) {
    return (object) [
      'base' => $c->get('base_url'),
      'facebook' => '',
      'linkedin' => '',
      'twitter' => '',
      'youtube' => '',
      'assets' => $c->get('urls.assets'),
      'images' => implode('/', [$c->get('urls.assets'), 'images']),
      'styles' => $c->get('urls.styles'),
      'scripts' => $c->get('urls.scripts')
    ];
  },
  'assets' => function(Container $c) {
    return (object) [
      'styles' => [
        'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.css',
        implode(DIRECTORY_SEPARATOR, [
          $c->get('urls.styles'),
          'main.css'
        ])
      ],
      'fonts' => [
        'text/css' => [
          'https://fonts.googleapis.com/css2?family=Roboto&display=swap',
          'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/brand-icons.woff',
          'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/brand-icons.woff2',
          'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/icons.woff',
          'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/icons.woff2',
          'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/outline-icons.woff',
          'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/outline-icons.woff2'
        ]
      ],
      'scripts' => [
        'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
        'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.js'
      ]
    ];
  },
  'visitas' => function(Container $c) {
    $filename = implode(DIRECTORY_SEPARATOR, [
      $c->get('folders.data'),
      'visitas.json'
    ]);
    $file = json_decode(trim(file_get_contents($filename)));
    return $file->visits;
  },
  Slim\Views\Blade::class => function(Container $c) {
    return new Slim\Views\Blade(
      $c->get('folders.templates'),
      $c->get('folders.cache'),
      null,
      [
        'page_language' => $c->get('language'),
        'urls' => $c->get('urls'),
        'assets' => $c->get('assets')
      ]
    );
  },
  ProVM\KI\Common\Service\Indicadores::class => function(Container $c) {
    return new ProVM\KI\Common\Service\Indicadores($c->get('urls.indicadores'));
  }
];
