<?php

Route::group ( [
    'prefix' => 'admin',
    'middleware' => 'web'
], function () {
    Route::group ( [
        'prefix' => 'wysiwyg',
        'namespace' => 'Rvsitebuilder\Wysiwyg\Http\Controllers\Backend',
        'middleware' => 'admin'
    ], function () {
        Route::group ( [
            'prefix' => 'uikit'
        ], function () {

            Route::get ( '/', [
                'as' => 'admin.wysiwyg.uikit.index',
                'uses' => 'UikitController@index'
            ] );

            Route::get ( '/create', [
                'as' => 'admin.wysiwyg.uikit.create',
                'uses' => 'UikitController@create'
            ] );

            Route::post ( '/store', [
                'as' => 'admin.wysiwyg.uikit.store',
                'uses' => 'UikitController@store'
            ] );

            Route::get ( '/show/active/design', [
                'as' => 'admin.wysiwyg.uikit.active',
                'uses' => 'UikitController@show'
            ] );

            Route::get ( '/imageeditor', [
                'as' => 'admin.wysiwyg.uikit.imageeditor',
                'uses' => 'UikitController@imageeditor'
            ] );




            /* TODO:
             * domain.com/__slug_prefix__/__slug_name__(?___page___=3&__sort__=desc)#archorlink
             *
             * 1. Dynamic slug lastRoute
             * 2. Static Route อื่น ๆ
             * 3. Page parameter
             * 4. anchor
             */

            Route::get ( '/show', [
                'as' => 'admin.wysiwyg.uikit.show',
                'uses' => 'UikitController@show'
            ] );

            Route::group ( [
                'prefix' => 'show'
            ], function () {

                Route::get ( '{slug_name}', [
                    'uses' => 'UikitController@show'
                ] );

                Route::get ( '{slug_prefix}/{slug_name}', [
                    'uses' => 'UikitController@show'
                ] )->where ( [
                    'slug_prefix' => '.*',
                    'slug_name' => '.*'
                ] );
            } );

            Route::get ( '/email', [
                'as' => 'admin.wysiwyg.uikit.email',
                'uses' => 'UikitController@showemail'
            ] );

            Route::group ( [
                'prefix' => 'email'
            ], function () {
                Route::get ( '{email_id}/{email_type}', [
                    'uses' => 'UikitController@showemail'
                ] );
            } );

        } );
    } );
} );
