package Daje::Plugin::Languages;
use Mojo::Base 'Mojolicious::Plugin', -base, -signatures;
use v5.42;

# NAME
# ====
#
# Daje::Plugin::Languages - Mojolicious Plugin
#
# SYNOPSIS
# ========
#
# Mojolicious
# ===========
#
#      $self->plugin('Languages');
#
# Mojolicious::Lite
# =================
#
#      plugin 'Languages';
#
# DESCRIPTION
# ===========
#
# Daje::Plugin::Languages is a Mojolicious plugin.
#
# METHODS
# =======
#
# Daje::Plugin::Languages inherits all methods from
# Mojolicious::Plugin and implements the following new ones.
#
# register
# ========
#  $plugin->register(Mojolicious->new);
#
# Register plugin in L<Mojolicious> application.
#
# SEE ALSO
# ========
#
# Mojolicious, Mojolicious::Guides, https://mojolicious.org.
#
# LICENSE
# =======
#
# Copyright (C) janeskil1525.
#
# This library is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
#
# AUTHOR
# ======
#
# janeskil1525 E<lt>janeskil1525@gmail.com
#

# This file is generated once automatically by Daje Tools 2026-02-21 07:32:38.
# It will not be touched by Daje Tools again.

# <!-- Autogenerated file 2026-02-21 07:32:38 -->

use Daje::Plugin::Languages::Routes;
use Daje::Plugin::Languages::Helpers;
use Daje::Plugin::Languages::Authorities;
use Daje::Plugin::Languages::Languages;

use Daje::Helper::Languages::Translations;
use Daje::Database::Migrator;

our $VERSION = '0.01';

sub register ($self, $app, $config) {
    $app->log->debug("Daje::Plugin::Languages::register start");

    my $r = $app->routes();

    $r->get($app->config->{project} . '/translations/')->to('Translations#translations_list');

    $app->helper(
        translations => sub {
            state  $translations = Daje::Helper::Languages::Translations->new(db => shift->pg->db)
        });

    my $migration->{class} = 'Daje::Database::Languages';
    $migration->{name} = 'languages';
    $migration->{migration} = 1;
    my $migrations;
    push @{$migrations}, $migration;
    try {
        Daje::Database::Migrator->new(
            pg         => $app->pg,
            migrations => $migrations,
        )->migrate();
    } catch ($e) {
        $app->log->error($e);
    };

    Daje::Plugin::Languages::Routes->new()->routes($app, $config);
    Daje::Plugin::Languages::Helpers->new()->helpers($app, $config);
    Daje::Plugin::Languages::Authorities->new(
        db => $app->pg->db
    )->authorize();
    Daje::Plugin::Languages::Languages->new(
        db => $app->pg->db
    )->language();


    $app->log->debug("Daje::Plugin::Languages::register ends");
}

1;


#################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################

=head1 NAME


Daje::Plugin::Languages - Mojolicious Plugin



=head1 SYNOPSIS




=head1 DESCRIPTION


Daje::Plugin::Languages is a Mojolicious plugin.



=head1 REQUIRES

L<Daje::Database::Migrator> 

L<Daje::Plugin::Languages::Languages> 

L<Daje::Plugin::Languages::Authorities> 

L<Daje::Plugin::Languages::Helpers> 

L<Daje::Plugin::Languages::Routes> 

L<v5.42> 

L<Mojo::Base> 


=head1 METHODS


Daje::Plugin::Languages inherits all methods from
Mojolicious::Plugin and implements the following new ones.



=head1 Mojolicious::Lite


     plugin 'Languages';



=head1 Mojolicious


     $self->plugin('Languages');



=head1 register

 $plugin->register(Mojolicious->new);

Register plugin in L<Mojolicious> application.



=head1 SEE ALSO


Mojolicious, Mojolicious::Guides, https://mojolicious.org.



=head1 AUTHOR


janeskil1525 E<lt>janeskil1525@gmail.com



=head1 LICENSE


Copyright (C) janeskil1525.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.



=cut

