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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class ProxyMappingRoute(UniversalBaseModel):
    source: str = pydantic.Field()
    """
    Source pattern: [protocol://]host[:port][/path], supports wildcard * in host
    """

    target: str = pydantic.Field()
    """
    Target address: [host:]port[/path]. Host defaults to 127.0.0.1
    """

    source_host: str = pydantic.Field()
    """
    Extracted host from source (used for GOST hosts)
    """

    source_path: typing.Optional[str] = pydantic.Field(default=None)
    """
    Extracted path from source (used for nginx location)
    """

    internal_port: int = pydantic.Field()
    """
    Internal nginx listen port for this domain group
    """

    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
