<?php

namespace common\logic\User\User\Service;

use common\logic\AbstractManager;
use common\logic\User\User\Model\User;

class UserManager extends AbstractManager
{
    protected UserBuilder $userBuilder;
    protected UserNotifier $userNotifier;

    public function loadDependencies(): void
    {
        $this->userBuilder = $this->loadService(UserBuilder::class);
        $this->userNotifier = $this->loadService(UserNotifier::class);
    }

    public function welcome(User $user)
    {
        $password = $this->userBuilder->generatePassword($user);
        $this->userNotifier->sendMailWelcome($user, $password);

    }

    public function newPassword(User $user)
    {
        $password = $this->userBuilder->generatePassword($user);
        $this->userNotifier->sendMailNewPassword($user, $password);
    }
}