using System.Security.Claims;
using HoneyBox.Model.Entities;

namespace HoneyBox.Core.Interfaces;

/// <summary>
/// JWT服务接口
/// </summary>
public interface IJwtService
{
    /// <summary>
    /// 生成JWT Token
    /// </summary>
    /// <param name="user">用户实体</param>
    /// <returns>JWT Token字符串</returns>
    string GenerateToken(User user);

    /// <summary>
    /// 验证JWT Token
    /// </summary>
    /// <param name="token">Token字符串</param>
    /// <returns>Claims主体</returns>
    ClaimsPrincipal? ValidateToken(string token);

    /// <summary>
    /// 从Token中提取用户ID
    /// </summary>
    /// <param name="token">Token字符串</param>
    /// <returns>用户ID，如果无效则返回null</returns>
    int? GetUserIdFromToken(string token);
}
