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

from ...core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from ...providers_generated.types.provider_config import ProviderConfig
from ...integration_points.types.integration_point_id import IntegrationPointId
from .bridge_selector import BridgeSelector
from .webhook_config import WebhookConfig
from ...management.types.mapping_chain import MappingChain
from ...management.types.additional_mapping import AdditionalMapping
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class CreateIntegrationRequest(UncheckedBaseModel):
    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Unique short name for this Integrations (lowercase [a-z0-9_-], can be used in URLs). Also used for case insensitive duplicate name detection and default sort order. Defaults to IntegrationId if both name and fullname are not specified.
    """

    fullname: typing.Optional[str] = pydantic.Field(default=None)
    """
    Human friendly display name for this Integrations, will auto-generate 'name' field (if 'name' is not specified). Defaults to the same value as the 'name' field if not specified.
    """

    provider_config: ProviderConfig = pydantic.Field()
    """
    Provider configuration for this Integration.
    """

    integration_point_id: typing.Optional[IntegrationPointId] = pydantic.Field(
        default=None
    )
    """
    Integration Point associated with this integration.
    """

    bridge_selector: typing.Optional[BridgeSelector] = pydantic.Field(default=None)
    """
    Use a Bridge to connect to the provider.
    """

    webhook_config: typing.Optional[WebhookConfig] = pydantic.Field(default=None)
    """
    Web hook config for this integration
    """

    mappings: typing.Optional[typing.List[MappingChain]] = pydantic.Field(default=None)
    """
    A list of mapping chains to apply to the integration. Each mapping chain is a list of mappings to apply to the integration in the order they should be applied. Mappings are applied by operation ID. Leave this empty to use the default default mappings.
    """

    additional_mappings: typing.Optional[typing.List[AdditionalMapping]] = (
        pydantic.Field(default=None)
    )
    """
    Additional data mappings for this integration. This allows for custom data to be mapped to the custom_fields portion of the response.
    """

    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
