<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
  return $router->app->version();
});

//Unprotected routes
$router->post('auth/login', ['uses' => 'AuthController@authenticate']);
$router->get('markers', ['uses' => 'MarkerController@getAll']);
$router->get('markers/{id}', ['uses' => 'MarkerController@getMarkerDetails']);
$router->post('markers/search', ['uses' => 'MarkerController@searchMarkers']);
$router->get('vectors', ['uses' => 'VectorsController@getAll']);
$router->get('vectors/{id}', ['uses' => 'VectorsController@getLayerDetails']);
$router->get('vectors/data/{id}', ['uses' => 'VectorsController@getLayerData']);

//Protected routes
$router->group(['middleware' => 'jwt.auth'],
  function() use ($router) {
    $router->post('markers', ['uses' => 'MarkerController@create']);
    $router->delete('markers/{id}', ['uses' => 'MarkerController@delete']);
    $router->post('markers/{id}', ['uses' => 'MarkerController@update']);

    $router->post('photos', ['uses' => 'PhotosController@create']);
    $router->delete('photos/{id}', ['uses' => 'PhotosController@delete']);

    $router->post('vectors', ['uses' => 'VectorsController@create']);
    $router->delete('vectors/{id}', ['uses' => 'VectorsController@delete']);
    $router->post('vectors/{id}', ['uses' => 'VectorsController@update']);
  }
);
