# -*- coding: utf-8 -*-
"""
认证 API 模块
提供 access_token 获取等认证相关功能
"""

from typing import Dict, Any
from .base import BaseMixin
from ..const import API_PATHS


class Auth(BaseMixin):
    """
    认证 API 类

    提供 access_token 获取等认证相关功能。
    """

    async def token(self, client_id: str, client_secret: str) -> Dict[str, Any]:
        """
        获取 access_token

        使用 client_id 和 client_secret 获取访问令牌。

        Args:
            client_id: 开发者 ID
            client_secret: 开发者密钥

        Returns:
            Dict[str, Any]: API 响应数据，包含 accessToken

        Returns Data Structure:
            {
                "code": 0,
                "message": "ok",
                "data": {
                    "accessToken": "token_value",
                    "expiresAt": "过期时间"
                }
            }

        Example:
            >>> result = await auth.token("client_id", "client_secret")
            >>> access_token = result["data"]["accessToken"]
        """
        return await self._send_request(
            API_PATHS.access_token,
            json={
                "clientID": client_id,
                "clientSecret": client_secret,
            },
        )
