namespace HoneyBox.Admin.Services;

/// <summary>
/// 验证码服务接口
/// </summary>
public interface ICaptchaService
{
    /// <summary>
    /// 生成验证码
    /// </summary>
    /// <returns>验证码Key和Base64图片</returns>
    CaptchaResult Generate();

    /// <summary>
    /// 验证验证码
    /// </summary>
    /// <param name="captchaKey">验证码Key</param>
    /// <param name="captchaCode">用户输入的验证码</param>
    /// <returns>是否验证通过</returns>
    bool Validate(string captchaKey, string captchaCode);
}

/// <summary>
/// 验证码生成结果
/// </summary>
public class CaptchaResult
{
    /// <summary>
    /// 验证码唯一标识
    /// </summary>
    public string CaptchaKey { get; set; } = null!;

    /// <summary>
    /// Base64编码的图片（包含data:image/png;base64,前缀）
    /// </summary>
    public string CaptchaImage { get; set; } = null!;
}
