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

namespace OmsorgCore.Infrastructure.Security;

public class PasswordPolicy : IPasswordPolicy
{
    private readonly PasswordPolicyOptions _options;

    public PasswordPolicy(IOptions<PasswordPolicyOptions> options)
    {
        _options = options.Value;
    }

    public int MinLength => _options.MinLength;

    public bool IsValid(string? password) => !string.IsNullOrEmpty(password) && password.Length >= MinLength;
}
