#!/usr/bin/env perl
use Mojo::Base -strict, -signatures;
use feature qw(unicode_strings);
my $default_page = {page_alias => 'коренъ', 'lang' => 'bg-bg'};
my %default_to   = (to => 'stranici#execute', name => 'коренъ');
{
  routes => [

    #{get  => '/',       to => 'example#welcome'},
    # Root page in all domains has by default alias 'коренъ' and language
    # 'bg-bg'. Change the value of page_alias and the alias value of the page's
    # row in table 'stranici' for example to 'index' if you want your root page
    # to have alias 'index'. Also change the 'lang' above in $default_page and
    # the language property language  of your root page if you wish.
    {any  => {'/'                  => $default_page}, %default_to, name => '/'},
    {any  => {'/index.html'        => $default_page}, %default_to, name => 'index'},
    {any  => {'/коренъ.bg-bg.html' => $default_page}, %default_to},
    {get  => '/in',  to => 'auth#form',     name => 'authform'},
    {post => '/in',  to => 'auth#sign_in',  name => 'sign_in'},
    {get  => '/out', to => 'auth#sign_out', name => 'sign_out'},
    {
      get  => '/first_login/<token:fl_token>',
      to   => 'auth#first_login_form',
      name => 'first_login_form'
    },
    {post => '/first_login', to => 'auth#first_login', name => 'first_login'},
    {
      any  => '/lost_password',
      to   => 'auth#lost_password_form',
      name => 'lost_password_form'
    },
    {
      under  => '/manage',
      to     => 'auth#under_management',
      name   => 'under_management',
      routes => [
        {any  => '/',                to => 'upravlenie#index', name => 'home_upravlenie'},
        {get  => '/groups',          to => 'groups#index',     name => 'home_groups'},
        {get  => '/groups/create',   to => 'groups#create',    name => 'create_groups'},
        {get  => '/groups/:id',      to => 'groups#show',      name => 'show_groups'},
        {post => '/groups',          to => 'groups#store',     name => 'store_groups'},
        {get  => '/groups/:id/edit', to => 'groups#edit',      name => 'edit_groups'},
        {put  => '/groups/:id',      to => 'groups#update',    name => 'update_groups'},
        {delete => '/groups/:id',    to => 'groups#remove',    name => 'remove_groups'},
        {get    => '/users',         to => 'users#index',      name => 'home_users'},
        {get    => '/users/create',  to => 'users#create',     name => 'create_users'},
        {get    => '/users/:id',     to => 'users#show',       name => 'show_users'},
        {post   => '/users',         to => 'users#store',      name => 'store_users'},
        {
          get  => '/users/store_result/:jid',
          to   => 'users#store_result',
          name => 'users_store_result'
        },
        {get    => '/users/:id/edit',  to => 'users#edit',     name => 'edit_users'},
        {put    => '/users/:id',       to => 'users#update',   name => 'update_users'},
        {delete => '/users/:id',       to => 'users#remove',   name => 'remove_users'},
        {get    => '/domove',          to => 'domove#index',   name => 'home_domove'},
        {get    => '/domove/create',   to => 'domove#create',  name => 'create_domove'},
        {get    => '/domove/:id',      to => 'domove#show',    name => 'show_domove'},
        {post   => '/domove',          to => 'domove#store',   name => 'store_domove'},
        {get    => '/domove/:id/edit', to => 'domove#edit',    name => 'edit_domove'},
        {put    => '/domove/:id',      to => 'domove#update',  name => 'update_domove'},
        {delete => '/domove/:id',      to => 'domove#remove',  name => 'remove_domove'},
        {get    => '/stranici',        to => 'stranici#index', name => 'home_stranici'},
        {get  => '/stranici/create',  to => 'stranici#create', name => 'create_stranici'},
        {get  => '/stranici/:id',     to => 'stranici#show',   name => 'show_stranici'},
        {post => '/stranici',         to => 'stranici#store',  name => 'store_stranici'},
        {get => '/stranici/:id/edit', to => 'stranici#edit',   name => 'edit_stranici'},
        {put => '/stranici/:id',      to => 'stranici#update', name => 'update_stranici'},
        {delete => '/stranici/:id',   to => 'stranici#remove', name => 'remove_stranici'},
        {
          get  => '/stranici/:page_id/celini',
          to   => 'celini#index',
          name => 'celini_in_stranica'
        },

        #the /celini route is DEPRECATED in favor of /stranici/:page_id/celini
        {get    => '/celini',          to   => 'celini#index',  name => 'home_celini'},
        {get    => '/celini/create',   to   => 'celini#create', name => 'create_celini'},
        {get    => '/celini/:id',      to   => 'celini#show',   name => 'show_celini'},
        {post   => '/celini',          to   => 'celini#store',  name => 'store_celini'},
        {get    => '/celini/:id/edit', to   => 'celini#edit',   name => 'edit_celini'},
        {put    => '/celini/:id',      to   => 'celini#update', name => 'update_celini'},
        {delete => '/celini/:id',      to   => 'celini#remove', name => 'remove_celini'},
        {under  => '/minion/',         name => 'home_minion', to => 'auth#under_minion',},
      ],
    },

    {
      any  => '/<page_alias:str>/<paragraph_alias:cel>.<lang:lng>.html',
      to   => 'celini#execute',
      name => 'para_with_lang'
    },
    {
      any  => '/<page_alias:str>.<lang:lng>.html',
      to   => 'stranici#execute',
      name => 'page_with_lang'
    },
    {
      any  => '/<page_alias:str>/<paragraph_alias:str>.html',
      to   => 'celini#execute',
      name => 'paragraph'
    },
    {any => '/<page_alias:str>.html', to => 'stranici#execute', name => 'page'},
  ]}