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

from ...core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .http_receiver_auth_config import HttpReceiverAuthConfig
from .http_receiver_method import HttpReceiverMethod
from .http_request_body_format import HttpRequestBodyFormat
from .http_receiver_signing_credential import HttpReceiverSigningCredential
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class SinkHttp(UncheckedBaseModel):
    """
    Generic Sink provider for sending events to any HTTP endpoint. Ideal for integrating with log aggregators, SIEM platforms, custom webhooks, data lakes, and any HTTP-based event ingestion system.
    """

    accepted_response_codes: typing.Optional[typing.List[int]] = pydantic.Field(
        default=None
    )
    """
    HTTP status codes that indicate successful event delivery. Defaults to standard success codes. Configure if receiving endpoint uses different response codes (e.g. `207 Multi-Status`).
    """

    authorization: typing.Optional[HttpReceiverAuthConfig] = pydantic.Field(
        default=None
    )
    """
    Configuration for authorizing requests with the receiving endpoint. Must be specified if the endpoint requires it. Can be combined with **Payload Signing** for defense-in-depth security.
    """

    http_method: typing.Optional[HttpReceiverMethod] = pydantic.Field(default=None)
    """
    HTTP method to use for sending events.
    """

    request_body_format: typing.Optional[HttpRequestBodyFormat] = pydantic.Field(
        default=None
    )
    """
    Format for serializing events in the HTTP request body. Choose based on receiving endpoint requirements and performance needs.
    
    - `jsonl` - JSON Lines (newline-delimited JSON) where each event is a separate JSON object on its own line. Memory efficient for large batches, supports streaming.
    - `json_array` - Standard JSON array format - events wrapped in `[{...}, {...}]`. Simpler structure, easier debugging and testing.
    """

    signing_credential: typing.Optional[HttpReceiverSigningCredential] = pydantic.Field(
        default=None
    )
    """
    Enables payload signing, allowing the receiving endpoint to verify payload integrity and authenticity.
    """

    skip_tls_verify: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Disables TLS certification verification.
    **Warning:** this disables security checks and makes connections vulnerable to man-in-the-middle attacks.
    """

    static_headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(
        default=None
    )
    """
    Additional HTTP headers to include on every request. Use for non-sensitive metadata like source system identifiers, API versioning, or custom routing headers that don't change per request.
    """

    url: str = pydantic.Field()
    """
    Receiving endpoint where events will be sent.
    """

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

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