"""
Type annotations for botocore.serialize module.

Copyright 2025 Vlad Emelianov
"""

from collections.abc import Mapping
from re import Pattern
from typing import Any

from botocore.compat import formatdate as formatdate
from botocore.model import OperationModel
from botocore.utils import is_json_value_header as is_json_value_header
from botocore.utils import parse_to_aware_datetime as parse_to_aware_datetime
from botocore.utils import percent_encode as percent_encode
from botocore.validate import ParamValidationDecorator

DEFAULT_TIMESTAMP_FORMAT: str = ...
ISO8601: str = ...
ISO8601_MICRO: str = ...
HOST_PREFIX_RE: Pattern[str] = ...

TIMESTAMP_PRECISION_DEFAULT: str = ...
TIMESTAMP_PRECISION_MILLISECOND: str = ...
TIMESTAMP_PRECISION_OPTIONS: tuple[str, ...] = ...

def create_serializer(
    protocol_name: str, include_validation: bool = ..., timestamp_precision: str = ...
) -> ParamValidationDecorator: ...

class Serializer:
    DEFAULT_METHOD: str = ...
    MAP_TYPE: type[dict[str, Any]] = ...
    DEFAULT_ENCODING: str = ...

    def __init__(self, timestamp_precision: str = ...) -> None: ...
    def serialize_to_request(
        self, parameters: Mapping[str, Any], operation_model: OperationModel
    ) -> dict[str, Any]: ...

class QuerySerializer(Serializer):
    TIMESTAMP_FORMAT: str = ...
    def serialize_to_request(
        self, parameters: Mapping[str, Any], operation_model: OperationModel
    ) -> dict[str, Any]: ...

class EC2Serializer(QuerySerializer): ...

class JSONSerializer(Serializer):
    TIMESTAMP_FORMAT: str = ...
    def serialize_to_request(
        self, parameters: Mapping[str, Any], operation_model: OperationModel
    ) -> dict[str, Any]: ...

class CBORSerializer(Serializer):
    UNSIGNED_INT_MAJOR_TYPE: int = ...
    NEGATIVE_INT_MAJOR_TYPE: int = ...
    BLOB_MAJOR_TYPE: int = ...
    STRING_MAJOR_TYPE: int = ...
    LIST_MAJOR_TYPE: int = ...
    MAP_MAJOR_TYPE: int = ...
    TAG_MAJOR_TYPE: int = ...
    FLOAT_AND_SIMPLE_MAJOR_TYPE: int = ...

class BaseRestSerializer(Serializer):
    QUERY_STRING_TIMESTAMP_FORMAT: str = ...
    HEADER_TIMESTAMP_FORMAT: str = ...
    KNOWN_LOCATIONS: list[str] = ...
    def serialize_to_request(
        self, parameters: Mapping[str, Any], operation_model: OperationModel
    ) -> dict[str, Any]: ...

class BaseRpcV2Serializer(Serializer): ...
class RestJSONSerializer(BaseRestSerializer, JSONSerializer): ...

class RestXMLSerializer(BaseRestSerializer):
    TIMESTAMP_FORMAT: str = ...

class RpcV2CBORSerializer(BaseRpcV2Serializer, CBORSerializer):
    TIMESTAMP_FORMAT: str = ...

SERIALIZERS: dict[str, Serializer]
