<?php
/**
 * Service Class
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @version     STUB: 1.1.0
 * @generated   2025-06-15 00:00:00
 * @package     bplan-base/globals
 * @subpackage  Services
 * @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\Services;


use BplanBase\Globals\Actions\User\Create;
use BplanBase\Globals\Actions\User\Delete;
use BplanBase\Globals\Actions\User\ResetPassword;
use BplanBase\Globals\Actions\User\Update;
use BplanBase\Globals\Models\User;
use Illuminate\Database\Eloquent\Model;


/**
 * Service Class
 *
 * @version     2.2.0 / 2026-03-17
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
class UserService
{

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


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


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


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


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


    /**
     *
     * @param       array $attributes
     *
     * @return      User
     *
     * @version     1.1.0 / 2026-03-17
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function create(array $attributes): User
    {
        $Action = new Create();

        $User = $Action->execute($attributes);

        $UserRecordService = new UserRecordService();

        $UserRecordService->create($User);

        return $User;

    } // create()


    /**
     *
     * @param       int|string|User $user
     *
     * @return      User
     *
     * @version     2.0.0 / 2025-05-03
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function delete(int|string|User $user): User
    {
        $Action = new Delete();

        return $Action->execute($user);

    } // delete()


    /**
     *
     * @param       int|string|User $user
     *
     * @return      User
     *
     * @version     1.0.0 / 2025-05-03
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function resetPassword(int|string|User $user): User
    {
        $Action = new ResetPassword();

        return $Action->execute($user);

    } // resetPassword()


    /**
     *
     * @param       int|string|User $user
     *
     * @param       array $attributes
     *
     * @return      User
     *
     * @version     2.0.0 / 2025-05-03
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function update(int|string|User $user, array $attributes): User
    {
        $Action = new Update();

        return $Action->execute($user, $attributes);

    } // update()


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


} // class UserService {}
