package Daje::Database::Model::Super::UsersUsers;
use Mojo::Base 'Daje::Database::Model::Super::Common::Base', -base, -signatures, -async_await;
use v5.42;

# NAME
# ====
#
# Daje::Database::Model::Super::UsersUsers - Daje db model
#
# SYNOPSIS
# ========
#
#
#       use Daje::Database::Model::Super::UsersUsers;
#
#       my $table = Daje::Database::Model::Super::UsersUsers->new(db => $db);
#
#       my $result = $table->load_users_users_pkey($self, $users_users_pkey);
#
#       my $result = $table->load_users_workflow_fkey($self, $users_workflow_fkey);
#
#       my $result = $table->load_users_role_fkey($self, $users_role_fkey);
#
#       my $result = $table->load_users_lan_fkey($self, $users_lan_fkey);
##
#       my $result = $table->insert($self, $data);
#
#       $table->update($self, $data) ;
#
#
# DESCRIPTION
# ===========
#
# Daje::Database::Model::Super::UsersUsers is a Model super class
#
# METHODS
# =======
#
#
# 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 automatically by Daje Tools 2026-02-27 18:02:25.
# It will be re-created by Daje Tools again and any changes
# will be over written.
#
# <!-- Autogenerated file 2026-02-27 18:02:25 -->

our $VERSION = '0.01';

has 'fields' => '"users_users_pkey", "editnum", "insby", "insdatetime", "modby", "moddatetime",
"users_workflow_fkey","avatar","password","active","mail","name","comment","position","biography",
"authorities_role_fkey","phone","department","employed",
"languages_lan_fkey","verified"';
has 'primary_key_name' => "users_users_pkey";
has 'table_name' => "users_users"; # 
has 'mandatory' => 'users_workflow_fkey,password,active,mail,authorities_role_fkey,employed,languages_lan_fkey,verified,';
has 'workflow' => 'users_workflow_fkey';

async sub load_users_workflow_fkey_p($self, $users_workflow_fkey) {
    return $self->load_users_workflow_fkey($users_workflow_fkey);
}

sub load_users_workflow_fkey($self, $users_workflow_fkey) {
    return $self->load_fkey(
        $self->table_name, $self->fields(), "users_workflow_fkey", $users_workflow_fkey
    );
}
async sub load_authorities_role_fkey_p($self, $authorities_role_fkey) {
    return $self->load_authorities_role_fkey($authorities_role_fkey);
}

sub load_authorities_role_fkey($self, $authorities_role_fkey) {
    return $self->load_fkey(
        $self->table_name, $self->fields(), "authorities_role_fkey", $authorities_role_fkey
    );
}
async sub load_languages_lan_fkey_p($self, $languages_lan_fkey) {
    return $self->load_languages_lan_fkey($languages_lan_fkey);
}

sub load_languages_lan_fkey($self, $languages_lan_fkey) {
    return $self->load_fkey(
        $self->table_name, $self->fields(), "languages_lan_fkey", $languages_lan_fkey
    );
}
async sub load_users_users_pkey_p($self, $users_users_pkey) {
    return $self->load_users_users_pkey($users_users_pkey);
}

sub load_users_users_pkey($self, $users_users_pkey) {
    return $self->load_pk(
        $self->table_name, $self->fields(), $self->primary_key_name(), $users_users_pkey
    );
}

sub insert($self, $data) {
    my $result = $self->SUPER::insert(
        $self->table_name, $data, $self->primary_key_name
    );
    return $result;
}

sub update($self, $data) {
    return $self->SUPER::update
    (
        $self->table_name, $data,
            {
                $self->primary_key_name() => $data->{$self->primary_key_name()}
            }
    );
}

sub delete($self, $primary_key) {
    return $self->SUPER::delete($self->table_name, { $self->primary_key_name() => $primary_key});
}
1;

