<?php

use Illuminate\Http\Request;

Route::group(
    [
        'prefix' => 'v1'
    ],
    function () {
        Route::group(
            [
                'prefix' => LaravelLocalization::setLocale(request()->segment(3))
            ],
            function () {
                // Entries / Pages
                Route::resource('entries', 'Api\EntryController')->only(['show']);
                // Little Mighty Hammer of Thor to help the frontend
                Route::resource('entries/capabilities', 'Api\EntryController')->only(['show']);

                // Careers - Open Positions
                Route::resource('careers', 'Api\OpenPositionController')->only(['index', 'show']);

                // Work - Projects
                Route::resource('work', 'Api\ProjectController')->only(['index', 'show']);

                // Team - Team Members
                Route::resource('team', 'Api\TeamMemberController')->only(['index']);

                // Blog Articles
                Route::resource('blog', 'Api\BlogController')->only(['index', 'show']);

                // Menus & Bootstrap
                Route::get('menus', 'Api\MenuController@index');
                Route::get('bootstrap', 'Api\BootstrapController@index');

                // Sitemap
                Route::get('frontend/sitemap', 'Api\SitemapController@index');

                Route::get('/{any}', 'Api\ApiController@index')->where('any', '.*');

                // Contact Us form
                Route::post('contacts', 'Api\ContactUsFormController@index');

                // Get Estimate form
                Route::post('estimate', 'Api\GetEstimateFormController@index');
            }
        );
    }
);
