"""
Type annotations for botocore.model module.

Copyright 2025 Vlad Emelianov
"""

from collections.abc import Mapping
from typing import Any, NamedTuple, TypeVar

from botocore.utils import CachedProperty

NOT_SET: object

class NoShapeFoundError(Exception): ...
class InvalidShapeError(Exception): ...
class OperationNotFoundError(Exception): ...
class InvalidShapeReferenceError(Exception): ...

_R = TypeVar("_R")

class ServiceId(str):
    def hyphenize(self) -> str: ...

class Shape:
    SERIALIZED_ATTRS: list[str]
    METADATA_ATTRS: list[str]
    MAP_TYPE: type[dict[str, Any]]
    def __init__(
        self,
        shape_name: str,
        shape_model: Mapping[str, Any],
        shape_resolver: ShapeResolver | None = ...,
    ) -> None:
        self.name: str
        self.type_name: str
        self.documentation: str

    @CachedProperty
    def serialization(self) -> dict[str, Any]: ...
    @CachedProperty
    def metadata(self) -> dict[str, Any]: ...
    @CachedProperty
    def required_members(self) -> list[str]: ...
    @CachedProperty
    def event_stream_name(self) -> None: ...

class StructureShape(Shape):
    @CachedProperty
    def members(self) -> dict[str, Shape]: ...
    @CachedProperty
    def error_code(self) -> str: ...
    @CachedProperty
    def is_document_type(self) -> bool: ...
    @CachedProperty
    def is_tagged_union(self) -> bool: ...

class ListShape(Shape):
    @CachedProperty
    def member(self) -> Shape: ...

class MapShape(Shape):
    @CachedProperty
    def key(self) -> Shape: ...
    @CachedProperty
    def value(self) -> Shape: ...

class StringShape(Shape):
    @CachedProperty
    def enum(self) -> list[str]: ...

class StaticContextParameter(NamedTuple):
    name: str
    value: bool | str

class ContextParameter(NamedTuple):
    name: str
    member_name: str

class ClientContextParameter(NamedTuple):
    name: str
    type: str
    documentation: str

class ServiceModel:
    def __init__(
        self, service_description: Mapping[str, Any], service_name: str | None = ...
    ) -> None:
        self.metadata: dict[str, Any]

    def shape_for(
        self, shape_name: str, member_traits: Mapping[str, Any] | None = ...
    ) -> Shape: ...
    def shape_for_error_code(self, error_code: int) -> Shape: ...
    def resolve_shape_ref(self, shape_ref: str) -> Shape: ...
    @CachedProperty
    def shape_names(self) -> list[str]: ...
    @CachedProperty
    def error_shapes(self) -> list[Shape]: ...
    def operation_model(self, operation_name: str) -> OperationModel: ...
    @CachedProperty
    def documentation(self) -> str: ...
    @CachedProperty
    def operation_names(self) -> list[str]: ...
    @CachedProperty
    def service_name(self) -> str: ...
    @CachedProperty
    def service_id(self) -> ServiceId: ...
    @CachedProperty
    def signing_name(self) -> str: ...
    @CachedProperty
    def api_version(self) -> str: ...
    @CachedProperty
    def protocol(self) -> str: ...
    @CachedProperty
    def protocols(self) -> list[str]: ...
    @CachedProperty
    def resolved_protocol(self) -> str: ...
    @CachedProperty
    def endpoint_prefix(self) -> str: ...
    @CachedProperty
    def endpoint_discovery_operation(self) -> OperationModel: ...
    @CachedProperty
    def endpoint_discovery_required(self) -> bool: ...
    @CachedProperty
    def client_context_parameters(self) -> list[ClientContextParameter]: ...
    @property
    def signature_version(self) -> str: ...
    @signature_version.setter
    def signature_version(self, value: str) -> None: ...
    @CachedProperty
    def is_query_compatible(self) -> bool: ...

class OperationModel:
    def __init__(
        self,
        operation_model: Mapping[str, Any],
        service_model: ServiceModel,
        name: str | None = ...,
    ) -> None:
        self.metadata: dict[str, Any]
        self.http: dict[str, Any]

    @CachedProperty
    def name(self) -> str: ...
    @property
    def wire_name(self) -> str: ...
    @property
    def service_model(self) -> ServiceModel: ...
    @CachedProperty
    def documentation(self) -> str: ...
    @CachedProperty
    def deprecated(self) -> bool: ...
    @CachedProperty
    def endpoint_discovery(self) -> OperationModel | None: ...
    @CachedProperty
    def is_endpoint_discovery_operation(self) -> bool: ...
    @CachedProperty
    def input_shape(self) -> StructureShape | None: ...
    @CachedProperty
    def output_shape(self) -> StructureShape | None: ...
    @CachedProperty
    def idempotent_members(self) -> list[str]: ...
    @CachedProperty
    def static_context_parameters(self) -> list[StaticContextParameter]: ...
    @CachedProperty
    def context_parameters(self) -> list[ContextParameter]: ...
    @CachedProperty
    def operation_context_parameters(self) -> list[ContextParameter]: ...
    @CachedProperty
    def request_compression(self) -> dict[str, Any] | None: ...
    @CachedProperty
    def auth(self) -> str | None: ...
    @CachedProperty
    def auth_type(self) -> str | None: ...
    @CachedProperty
    def resolved_auth_type(self) -> str | None: ...
    @CachedProperty
    def unsigned_payload(self) -> Any: ...
    @CachedProperty
    def error_shapes(self) -> list[Shape]: ...
    @CachedProperty
    def endpoint(self) -> str | None: ...
    @CachedProperty
    def http_checksum_required(self) -> bool: ...
    @CachedProperty
    def http_checksum(self) -> dict[str, Any]: ...
    @CachedProperty
    def has_event_stream_input(self) -> bool: ...
    @CachedProperty
    def has_event_stream_output(self) -> bool: ...
    def get_event_stream_input(self) -> Shape | None: ...
    def get_event_stream_output(self) -> Shape | None: ...
    @CachedProperty
    def has_streaming_input(self) -> bool: ...
    @CachedProperty
    def has_streaming_output(self) -> bool: ...
    def get_streaming_input(self) -> Shape | None: ...
    def get_streaming_output(self) -> Shape | None: ...

class ShapeResolver:
    SHAPE_CLASSES: dict[str, Shape]
    def __init__(self, shape_map: Mapping[str, Shape]) -> None: ...
    def get_shape_by_name(
        self, shape_name: str, member_traits: Mapping[str, Any] | None = ...
    ) -> Shape: ...
    def resolve_shape_ref(self, shape_ref: Mapping[str, Any]) -> Shape: ...

class UnresolvableShapeMap:
    def get_shape_by_name(
        self, shape_name: str, member_traits: Mapping[str, Any] | None = ...
    ) -> Shape: ...
    def resolve_shape_ref(self, shape_ref: Mapping[str, Any]) -> Shape: ...

class DenormalizedStructureBuilder:
    SCALAR_TYPES: tuple[str, ...]

    def __init__(self, name: str | None = ...) -> None:
        self.name: str
        self.members: dict[str, Any]

    def with_members(self: _R, members: Mapping[str, Any]) -> _R: ...
    def build_model(self) -> StructureShape: ...

class ShapeNameGenerator:
    def __init__(self) -> None: ...
    def new_shape_name(self, type_name: str) -> str: ...
