<?php

declare(strict_types=1);

use apexl\Io\modules\user\entities\userEntity;
use apexl\Io\modules\user\interfaces\JwtKeyProviderInterface;
use apexl\Io\modules\user\interfaces\newUserNotifier;
use apexl\Io\modules\user\interfaces\TokenHasherInterface;
use apexl\Io\modules\user\interfaces\UserPasswordHasherInterface;
use apexl\Io\modules\user\interfaces\UserPasswordVerifierInterface;
use apexl\Io\modules\user\notifiers\newUserEmailNotifier;
use apexl\Io\modules\user\services\JwtKeyFromConfigService;
use apexl\Io\modules\user\services\NativeTokenHasher;
use apexl\Io\modules\user\services\PasswordHashUserPasswordHasher;
use apexl\Io\modules\user\services\PasswordVerifyUserPasswordVerifier;
use function apexl\Io\container;
use function DI\autowire;
use function DI\factory;

return [
    newUserNotifier::class => factory(fn(userEntity $user): newUserNotifier => container()->make(
        newUserEmailNotifier::class,
        ['user' => $user]
    )),
    JwtKeyProviderInterface::class => autowire(JwtKeyFromConfigService::class),
    TokenHasherInterface::class => autowire(NativeTokenHasher::class),
    UserPasswordHasherInterface::class => autowire(PasswordHashUserPasswordHasher::class),
    UserPasswordVerifierInterface::class => autowire(PasswordVerifyUserPasswordVerifier::class),
];
