# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
from ..core.unchecked_base_model import UncheckedBaseModel
from .literal_json_schema_property import LiteralJsonSchemaProperty
from .query_params_json_schema import QueryParamsJsonSchema
from .response_filter import ResponseFilter
from .webhook_tool_api_schema_config_output_auth_connection import WebhookToolApiSchemaConfigOutputAuthConnection
from .webhook_tool_api_schema_config_output_content_type import WebhookToolApiSchemaConfigOutputContentType
from .webhook_tool_api_schema_config_output_method import WebhookToolApiSchemaConfigOutputMethod
from .webhook_tool_api_schema_config_output_request_headers_value import (
    WebhookToolApiSchemaConfigOutputRequestHeadersValue,
)


class WebhookToolApiSchemaConfigOutput(UncheckedBaseModel):
    request_headers: typing.Optional[typing.Dict[str, WebhookToolApiSchemaConfigOutputRequestHeadersValue]] = (
        pydantic.Field(default=None)
    )
    """
    Headers that should be included in the request
    """

    url: str = pydantic.Field()
    """
    The URL that the webhook will be sent to. May include path parameters, e.g. https://example.com/agents/{agent_id}
    """

    method: typing.Optional[WebhookToolApiSchemaConfigOutputMethod] = pydantic.Field(default=None)
    """
    The HTTP method to use for the webhook
    """

    path_params_schema: typing.Optional[typing.Dict[str, LiteralJsonSchemaProperty]] = pydantic.Field(default=None)
    """
    Schema for path parameters, if any. The keys should match the placeholders in the URL.
    """

    query_params_schema: typing.Optional[QueryParamsJsonSchema] = pydantic.Field(default=None)
    """
    Schema for any query params, if any. These will be added to end of the URL as query params. Note: properties in a query param must all be literal types
    """

    request_body_schema: typing.Optional["ObjectJsonSchemaPropertyOutput"] = pydantic.Field(default=None)
    """
    Schema for the body parameters, if any. Used for POST/PATCH/PUT requests. The schema should be an object which will be sent as the json body
    """

    response_body_schema: typing.Optional["ObjectJsonSchemaPropertyOutput"] = pydantic.Field(default=None)
    """
    Schema describing the expected response body structure. For documentation only; not surfaced to the LLM.
    """

    response_filter: typing.Optional[ResponseFilter] = pydantic.Field(default=None)
    """
    Optional allow-list filter applied to the response before the LLM sees it, so large responses don't pollute the context. Defaults to the full response.
    """

    content_type: typing.Optional[WebhookToolApiSchemaConfigOutputContentType] = pydantic.Field(default=None)
    """
    Content type for the request body. Only applies to POST/PUT/PATCH requests.
    """

    auth_resolved_params: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    URL placeholders resolved from the auth connection (e.g. secrets injected via UrlSecretAuthConnection) rather than from path_params_schema.
    """

    auth_connection: typing.Optional[WebhookToolApiSchemaConfigOutputAuthConnection] = pydantic.Field(default=None)
    """
    Optional auth connection to use for authentication with this webhook
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput  # noqa: E402, I001
from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems  # noqa: E402, I001
from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput  # noqa: E402, I001
from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue  # noqa: E402, I001

update_forward_refs(
    WebhookToolApiSchemaConfigOutput,
    ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput,
    ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems,
    ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput,
    ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue,
)
