import logging
from ..aws_operations import (
    get_secret_binary as get_secret_binary,
    s3_get_object_bytes as s3_get_object_bytes,
    s3_put_object_bytes as s3_put_object_bytes,
    ses_send_email as ses_send_email,
)
from ..custom_types import (
    Clients as Clients,
    Config as Config,
    CustomError as CustomError,
    HttpError as HttpError,
    HttpSuccess as HttpSuccess,
    JwtParam as JwtParam,
    LoginHash as LoginHash,
    MagicLinkDomain as MagicLinkDomain,
    MagicLinkDto as MagicLinkDto,
    MagicLinkInternal as MagicLinkInternal,
    RoleEnum as RoleEnum,
    WhoAmI as WhoAmI,
)
from ..http_return import (
    http_200_json as http_200_json,
    http_400_json as http_400_json,
    http_403_json as http_403_json,
    http_500_json as http_500_json,
    http_error as http_error,
    http_error_to_json_response as http_error_to_json_response,
)
from botocore.client import Config as Boto3Config
from ecdsa import SigningKey as SigningKey, VerifyingKey as VerifyingKey
from fastapi import APIRouter, Request as Request
from fastapi.responses import JSONResponse as JSONResponse
from mypy_boto3_secretsmanager import SecretsManagerClient
from typing import Any, Dict, List, Union

LOG: logging.Logger

class Auth:
    default_algorithm: str
    default_boto3_config: Boto3Config
    clients: Clients
    config: Config
    boto3_config: Boto3Config
    router: APIRouter
    def __init__(self, config: Config, boto3_config=...) -> None: ...
    @staticmethod
    def get_signing_key(
        secrets_manager_client: SecretsManagerClient, secret_id: str
    ) -> Union[SigningKey, HttpError]: ...
    @staticmethod
    def create_jwt(
        jwt_param: JwtParam,
        signing_key: SigningKey,
        audience: str,
        issuer: str,
        exp_days: int,
        algorithm: str = ...,
    ) -> Union[str, CustomError]: ...
    @staticmethod
    def decode_jwt(
        jwt_string: str,
        verifying_key: VerifyingKey,
        audience: str,
        algorithm: str = ...,
    ) -> Union[Dict[str, Any], CustomError]: ...
    @staticmethod
    def get_jwt_token_from_cookies(
        cookies: Dict[str, Any], jwt_name: str
    ) -> Union[str, CustomError]: ...
    @staticmethod
    def get_jwt_field_from_cookies(
        cookies: Dict[str, Any],
        jwt_name: str,
        verifying_key: VerifyingKey,
        audience: str,
        jwt_field_name: str,
    ) -> Union[str, CustomError]: ...
    @staticmethod
    def get_jwt_fields_from_cookies(
        cookies: Dict[str, Any],
        jwt_name: str,
        verifying_key: VerifyingKey,
        audience: str,
        jwt_field_names: List[str],
    ) -> Union[List[str], List[CustomError]]: ...
    @staticmethod
    def get_user_email_from_cookies(
        cookies: Dict[str, Any],
        jwt_name: str,
        verifying_key: VerifyingKey,
        audience: str,
    ) -> Union[str, CustomError]: ...
    @staticmethod
    def get_user_role_from_cookies(
        cookies: Dict[str, Any],
        jwt_name: str,
        verifying_key: VerifyingKey,
        audience: str,
    ) -> Union[str, CustomError]: ...
    @staticmethod
    def get_cookie_domain_from_cors(cors_allow_origin: str) -> str: ...
    def convert_magic_link_domain_to_internal(
        self, magic_link: MagicLinkDomain, source_ip: str
    ) -> MagicLinkInternal: ...
    def save_magic_link_internal_to_s3(
        self, magic_link_internal: MagicLinkInternal, utc_now_str: str
    ) -> Union[HttpSuccess, HttpError]: ...
    def render_email_body(
        self, magic_link_internal: MagicLinkInternal
    ) -> Union[str, CustomError]: ...
    def get_hash_from_s3(
        self, login_hash: LoginHash
    ) -> Union[MagicLinkInternal, HttpError]: ...
    @staticmethod
    def magic_link_dto_to_domain(
        magic_link_dto: MagicLinkDto,
    ) -> Union[MagicLinkDomain, CustomError]: ...
    async def send_magic_link(
        self, magic_link_dto: MagicLinkDto, request: Request
    ) -> JSONResponse: ...
    def set_cookie_with_domain_on_response(
        self,
        cookie_domain: str,
        http_response: JSONResponse,
        jwt_token: str,
        max_age: int,
    ) -> JSONResponse: ...
    async def login(self, login_hash: LoginHash) -> JSONResponse: ...
    async def logout(self) -> JSONResponse: ...
    async def get_who_am_i(self, request: Request) -> JSONResponse: ...
