# Generated by ariadne-codegen
# Source: zeabur_schema.graphql

from typing import Any, Optional

from pydantic import Field

from .base_model import BaseModel
from .enums import (
    ServiceSpecGitSource,
    ServiceSpecHealthCheckType,
    ServiceSpecPortType,
    ServiceTemplate,
    TemplateVariableType,
)


class DeploymentSpecification(BaseModel):
    source: Optional["ServiceSpecSourceInput"] = None
    env: Optional[list["ServiceSpecEnvInput"]] = None


class GitRef(BaseModel):
    repo_id: int = Field(alias="repoID")
    ref: Optional[str] = None


class GroupInput(BaseModel):
    name: Optional[str] = None
    "Group name\n\nnull = ungrouped"
    service_i_ds: list[Any] = Field(alias="serviceIDs")


class HealthCheckInput(BaseModel):
    probe: Optional["ProbeInput"] = None


class ProbeHttpGetInput(BaseModel):
    path: Optional[str] = None


class ProbeInput(BaseModel):
    http_get: Optional["ProbeHttpGetInput"] = Field(alias="httpGet", default=None)


class RepoConfigInput(BaseModel):
    service_name: str = Field(alias="serviceName")
    repo_name: str = Field(alias="repoName")
    is_public_repo: bool = Field(alias="isPublicRepo")


class ResourceLimitInput(BaseModel):
    cpu: Optional[int] = None
    memory: Optional[int] = None


class ServiceSpecConfigInput(BaseModel):
    path: str
    template: str
    permission: Optional[int] = None
    envsubst: Optional[bool] = None


class ServiceSpecConnectionInstructionInput(BaseModel):
    title: str
    content: str


class ServiceSpecEnvInput(BaseModel):
    key: str
    default: Optional[str] = None
    expose: Optional[bool] = None


class ServiceSpecGPUInput(BaseModel):
    enabled: bool


class ServiceSpecHealthCheckHTTPInput(BaseModel):
    path: str


class ServiceSpecHealthCheckInput(BaseModel):
    type: ServiceSpecHealthCheckType
    port: str
    http: Optional["ServiceSpecHealthCheckHTTPInput"] = None


class ServiceSpecInitRuleInput(BaseModel):
    id: str
    image: Optional[str] = None
    command: Optional[list[str]] = None
    volumes: Optional[list["ServiceSpecInitVolumeMountInput"]] = None


class ServiceSpecInitVolumeMountInput(BaseModel):
    id: str
    mount_path: str = Field(alias="mountPath")
    sub_path: Optional[str] = Field(alias="subPath", default=None)


class ServiceSpecPortForwardingInput(BaseModel):
    enabled: bool


class ServiceSpecPortInput(BaseModel):
    id: str
    port: int
    type: ServiceSpecPortType


class ServiceSpecSchemaInput(BaseModel):
    """Service Specification (ServiceSpec).

    See the specification for the detailed documentation:
    https://json-schema.app/view/%23?url=https%3A%2F%2Fschema.zeabur.app%2Fprebuilt.json
    """

    id: Optional[str] = None
    name: str
    icon: Optional[str] = None
    source: "ServiceSpecSourceInput"
    ports: Optional[list["ServiceSpecPortInput"]] = None
    volumes: Optional[list["ServiceSpecVolumeEntryInput"]] = None
    instructions: Optional[list["ServiceSpecConnectionInstructionInput"]] = None
    env: Optional[list["ServiceSpecEnvInput"]] = None
    init_rules: Optional[list["ServiceSpecInitRuleInput"]] = Field(
        alias="initRules", default=None
    )
    configs: Optional[list["ServiceSpecConfigInput"]] = None
    gpu: Optional["ServiceSpecGPUInput"] = None
    health_check: Optional["ServiceSpecHealthCheckInput"] = Field(
        alias="healthCheck", default=None
    )
    port_forwarding: Optional["ServiceSpecPortForwardingInput"] = Field(
        alias="portForwarding", default=None
    )


class ServiceSpecSourceInput(BaseModel):
    image: Optional[str] = None
    username: Optional[str] = None
    password: Optional[str] = None
    source: Optional[ServiceSpecGitSource] = None
    repo_id: Optional[int] = Field(alias="repoID", default=None)
    upload_id: Optional[str] = Field(alias="uploadID", default=None)
    branch: Optional[str] = None
    submodule_name: Optional[str] = Field(alias="submoduleName", default=None)
    watch_paths: Optional[list[str]] = Field(alias="watchPaths", default=None)
    root_directory: Optional[str] = Field(alias="rootDirectory", default=None)
    dockerfile: Optional[str] = None
    command: Optional[list[str]] = None
    args: Optional[list[str]] = None
    run_as_user_id: Optional[int] = Field(alias="runAsUserID", default=None)


class ServiceSpecVolumeEntryInput(BaseModel):
    id: str
    dir: str


class TemplateVariableInput(BaseModel):
    type: TemplateVariableType
    question: str
    key: str
    desc: str


class TriggerInput(BaseModel):
    repo_id: int = Field(alias="repoID")
    branch_name: str = Field(alias="branchName")


class VariableInput(BaseModel):
    key: str
    value: str


class VariablePropertyInput(BaseModel):
    readonly: Optional[bool] = None
    exposed: Optional[bool] = None


class createServiceInput(BaseModel):
    name: str
    "serviceName must be unique in a template."
    template: ServiceTemplate
    'Deploy from "GIT" or "MARKETPLACE".'
    repo_id: Optional[int] = Field(alias="repoID", default=None)
    'Optional, Only used if template is "GIT".'
    root_directory: Optional[str] = Field(alias="rootDirectory", default=None)
    'Optional, Only used if template is "GIT".\nIf the service is not in the root of the repo, specify the path to the service.'
    branch_name: Optional[str] = Field(alias="branchName", default=None)
    'Optional, Only used if template is "GIT".\nWhich branch will trigger the build, will use default branch if not specified.'
    custom_build_command: Optional[str] = Field(
        alias="customBuildCommand", default=None
    )
    'Optional, Only used if template is "GIT".\nOverride the default build command.'
    custom_start_command: Optional[str] = Field(
        alias="customStartCommand", default=None
    )
    'Optional, Only used if template is "GIT".\nOverride the default start command.'
    output_dir: Optional[str] = Field(alias="outputDir", default=None)
    'Optional, Only used if template is "GIT".'
    watch_paths: Optional[list[str]] = Field(alias="watchPaths", default=None)
    'Optional, Only used if template is "GIT".'
    item_code: Optional[str] = Field(alias="itemCode", default=None)
    'Opional, Only used if template is "MARKETPLACE".'
    variables: Optional[Any] = None
    "Optional, the Environment variable key to the given value"
    domain_key: Optional[str] = Field(alias="domainKey", default=None)
    "Optional, the key of the variable containing the domain to bind on the port.\n\nIf there is more than 1 ports defined in the service, it picks the first HTTP port.\nBinding multiple ports is currently only possible on Resource YAML."
    prebuilt_item_code: Optional[str] = Field(alias="prebuiltItemCode", default=None)


DeploymentSpecification.model_rebuild()
HealthCheckInput.model_rebuild()
ProbeInput.model_rebuild()
ServiceSpecHealthCheckInput.model_rebuild()
ServiceSpecInitRuleInput.model_rebuild()
ServiceSpecSchemaInput.model_rebuild()
