<?php

namespace Origo\Services;

class Router {

  /**
   * The routes.
   *
   * @var array
   */
  private $routes;

  /**
   * Add common services.
   */
  public function __construct() {
    $this->routes = [
      '/' => \Origo\Controller\MainController::class,
      '/planner' => \Origo\Controller\PlannerController::class,
      '/dashboard' => \Origo\Controller\UserDashboardController::class,
      '/user-login' => \Origo\Controller\UserLoginController::class,
      '/api/v1/webhook' => \Origo\Controller\ApiWebhookController::class,
    ];
  }

  /**
   * Get the route controller.
   *
   * @param string $path
   *   The path.
   * @return string
   *   The controller.
   */
  public function getRouteController(string $path): string {
    return $this->routes[$path];
  }

  /**
   * Check that the route exists.
   *
   *  @param string $path
   *    The path.
   *  @return bool
   */ 
  public function routeExists(string $path): bool {
    $route_exists = FALSE;
    if (array_key_exists($path, $this->routes)) {
      $route_exists = TRUE;
    }

    return $route_exists;
  }

}
