<?php #CodeGenerator V3 Δ 08649356861163c711fa9a9529e4e0a5 Δ DYNAMICALLY GENERATED FILE - Do not modify this line! Remove it completely to protect the file from changes.
/**
 * Livewire Component
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @version     STUB: 1.0.0
 * @generated   2026-04-07 01:48:23
 * @package     bplan-base/globals
 * @subpackage  LivewireComponents
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025, 2026 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */

namespace BplanBase\Globals\Livewire\Role\Modals;


use BplanBase\Globals\Models\Role;
use BplanBase\Globals\Services\RoleService;
use Livewire\Component;


/**
 * Livewire Component
 *
 * @version     1.0.0 / 2026-04-07
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
class Create extends Component
{


/* +++ TRAITS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ CLASS CONSTANTS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ OBJECT MEMBERS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     * @var         Role
     */
    public Role $role;


    /**
     * @var         RoleService $Service
     */
    protected RoleService $_Service;


/* +++ CLASS MEMBERS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     * @var
     */
    private static $_logPrefix = 'Role/Modals/Create';


/* +++ OBJECT METHODS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     *
     * @version     1.0.0 / 2026-04-07
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function create()
    {
        $this->validate();

        try {
            $attributes = [
                //
            ];
            $this->Service->create($attributes);

        } catch (\Throwable $th) {
            //LogHelper::logException($th);
        }
    } // create()


    /**
     *
     * @param       RoleService $Service
     *
     * @version     1.0.0 / 2026-04-07
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function boot(RoleService $Service)
    {
        $this->_Service = $Service;

    } // boot()


    /**
     *
     * @return      void
     *
     * @version     1.0.0 / 2026-04-07
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function createRole()
    {
//        $this->validate([
//            'name' => 'required',
//            'email' => 'required|email:rfc,dns|unique:users,email',
//            'selectedRoles' => 'required|min:1',
//        ]);
//
//        try {
//            $UserService = new UserService();
//
//            $newUser = $UserService->create([
//                'name' => $this->name,
//                'email' => $this->email,
//            ]);
//            $roleUserService = new RoleUserService();
//
//            foreach ($this->selectedRoles as $roleIndex => $isRoleSelected) {
//                if($isRoleSelected) {
//                    $roleUserService->create([
//                        'user_id' => $newUser->id,
//                        'role_id' => $this->roles[$roleIndex]->id
//                    ]);
//                }
//            }
//            $User = auth()->user();
//
//            \AppLog::info('User '.$this->name.' ['.$this->email.'] created by ' . $User->name . ' ['.$User->email.']', prefix: self::$_logPrefix);
//
//            $this->dispatch('init-tippyjs');
//            $this->dispatch('user-created');
//
//        } catch (\Throwable $th) {
//            \AppLog::error($th, prefix: self::$_logPrefix);
//
//            $this->dangerBanner('Error when adding user. Check the logs for more information.');
//        }
    } // createRole()


    /**
     *
     * @version     1.0.0 / 2026-04-07
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function mount()
    {
        //
    } // mount()


    /**
     *
     * @version     1.0.0 / 2026-04-07
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function render()
    {
        return view('globals::livewire.role.modals.create');

    } // render()


    /**
     *
     * @return      array
     *
     * @version     1.0.0 / 2026-04-07
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function rules(): array
    {
        $rules = [];

        return $rules;

    } // rules()


/* +++ CLASS METHODS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


} // class Create extends Component {}
