# generated by datamodel-codegen:
#   filename:  RegistryOverrides.yaml

from __future__ import annotations

from typing import List, Optional

from pydantic import AnyUrl, BaseModel, Extra, Field
from typing_extensions import Literal


class AllowedHosts(BaseModel):
    class Config:
        extra = Extra.allow

    hosts: Optional[List[str]] = Field(
        None,
        description="An array of hosts that this connector can connect to.  AllowedHosts not being present for the source or destination means that access to all hosts is allowed.  An empty list here means that no network access is granted.",
    )


class NormalizationDestinationDefinitionConfig(BaseModel):
    class Config:
        extra = Extra.allow

    normalizationRepository: str = Field(
        ...,
        description="a field indicating the name of the repository to be used for normalization. If the value of the flag is NULL - normalization is not used.",
    )
    normalizationTag: str = Field(
        ...,
        description="a field indicating the tag of the docker repository to be used for normalization.",
    )
    normalizationIntegrationType: str = Field(
        ...,
        description="a field indicating the type of integration dialect to use for normalization.",
    )


class SuggestedStreams(BaseModel):
    class Config:
        extra = Extra.allow

    streams: Optional[List[str]] = Field(
        None,
        description="An array of streams that this connector suggests the average user will want.  SuggestedStreams not being present for the source means that all streams are suggested.  An empty list here means that no streams are suggested.",
    )


class ResourceRequirements(BaseModel):
    class Config:
        extra = Extra.forbid

    cpu_request: Optional[str] = None
    cpu_limit: Optional[str] = None
    memory_request: Optional[str] = None
    memory_limit: Optional[str] = None


class JobType(BaseModel):
    __root__: Literal[
        "get_spec",
        "check_connection",
        "discover_schema",
        "sync",
        "reset_connection",
        "connection_updater",
        "replicate",
    ] = Field(
        ...,
        description="enum that describes the different types of jobs that the platform runs.",
        title="JobType",
    )


class JobTypeResourceLimit(BaseModel):
    class Config:
        extra = Extra.forbid

    jobType: JobType
    resourceRequirements: ResourceRequirements


class ActorDefinitionResourceRequirements(BaseModel):
    class Config:
        extra = Extra.forbid

    default: Optional[ResourceRequirements] = Field(
        None,
        description="if set, these are the requirements that should be set for ALL jobs run for this actor definition.",
    )
    jobSpecific: Optional[List[JobTypeResourceLimit]] = None


class RegistryOverrides(BaseModel):
    class Config:
        extra = Extra.forbid

    enabled: bool
    name: Optional[str] = None
    dockerRepository: Optional[str] = None
    dockerImageTag: Optional[str] = None
    supportsDbt: Optional[bool] = None
    supportsNormalization: Optional[bool] = None
    license: Optional[str] = None
    documentationUrl: Optional[AnyUrl] = None
    connectorSubtype: Optional[str] = None
    allowedHosts: Optional[AllowedHosts] = None
    normalizationConfig: Optional[NormalizationDestinationDefinitionConfig] = None
    suggestedStreams: Optional[SuggestedStreams] = None
    resourceRequirements: Optional[ActorDefinitionResourceRequirements] = None
