import Foundation

/// API 配置信息
public enum APIConfig {
    /// API 基础 URL
    public static let baseURL = "https://api.memorywake.com/api/v1"
    
    /// 认证 token - 从 Keychain 中获取
    public static var authToken: String {
        let token = KeychainHelper.getAccessToken() ?? ""
        if !token.isEmpty {
            print("🔑 [APIConfig] 当前访问令牌: \(token.prefix(10))...") // 只打印前10个字符，避免敏感信息完全暴露
        } else {
            print("⚠️ [APIConfig] 未找到访问令牌")
        }
        return token
    }

    /// 认证请求头
    public static var authHeaders: [String: String] {
        let token = authToken
        var headers = [
            "Content-Type": "application/json",
            "Accept": "application/json"
        ]
        
        if !token.isEmpty {
            headers["Authorization"] = "Bearer \(token)"
        }
        
        return headers
    }

}
