using Microsoft.Extensions.Options;
using OmsorgCore.Application.Abstractions;

namespace OmsorgCore.Infrastructure.Security;

public class LoginLockoutPolicy : ILoginLockoutPolicy
{
    private readonly LoginAttemptOptions _options;

    public LoginLockoutPolicy(IOptions<LoginAttemptOptions> options)
    {
        _options = options.Value;
    }

    public int MaxFailures => _options.MaxLoginFailures;
    public TimeSpan LockoutWindow => TimeSpan.FromMinutes(_options.LoginLockoutMinutes);
}
