# Generated by ariadne-codegen
# Source: operations/

from typing import Any, Optional

from pydantic import Field

from .base_model import BaseModel
from .enums import ServiceTemplate, TemplateVariableType


class CreateTemplate(BaseModel):
    create_template: "CreateTemplateCreateTemplate" = Field(alias="createTemplate")


class CreateTemplateCreateTemplate(BaseModel):
    code: str
    name: str
    description: str
    cover_url: Optional[str] = Field(alias="coverURL")
    icon_url: Optional[str] = Field(alias="iconURL")
    preview_url: Optional[str] = Field(alias="previewURL")
    author: "CreateTemplateCreateTemplateAuthor"
    created_at: Any = Field(alias="createdAt")
    readme: str
    resource_usage: Optional["CreateTemplateCreateTemplateResourceUsage"] = Field(
        alias="resourceUsage"
    )
    services: list["CreateTemplateCreateTemplateServices"]
    deployment_cnt: int = Field(alias="deploymentCnt")
    tags: Optional[list[str]]
    variables: Optional[list["CreateTemplateCreateTemplateVariables"]]


class CreateTemplateCreateTemplateAuthor(BaseModel):
    username: str
    avatar_url: str = Field(alias="avatarURL")


class CreateTemplateCreateTemplateResourceUsage(BaseModel):
    cpu: Optional[int]
    memory: Optional[int]


class CreateTemplateCreateTemplateServices(BaseModel):
    name: str
    template: ServiceTemplate
    git_repo_id: Optional[int] = Field(alias="gitRepoID")
    git_repo: Optional["CreateTemplateCreateTemplateServicesGitRepo"] = Field(
        alias="gitRepo"
    )
    branch_name: Optional[str] = Field(alias="branchName")
    custom_build_command: Optional[str] = Field(alias="customBuildCommand")
    custom_start_command: Optional[str] = Field(alias="customStartCommand")
    output_dir: Optional[str] = Field(alias="outputDir")
    root_directory: Optional[str] = Field(alias="rootDirectory")
    watch_paths: Optional[list[str]] = Field(alias="watchPaths")
    plan_type: Optional[str] = Field(alias="planType")
    plan_meta: Optional[Any] = Field(alias="planMeta")
    prebuilt_item: Optional["CreateTemplateCreateTemplateServicesPrebuiltItem"] = Field(
        alias="prebuiltItem"
    )
    variables: Optional[Any]
    spec: Optional["CreateTemplateCreateTemplateServicesSpec"]


class CreateTemplateCreateTemplateServicesGitRepo(BaseModel):
    id: int


class CreateTemplateCreateTemplateServicesPrebuiltItem(BaseModel):
    id: Optional[str]


class CreateTemplateCreateTemplateServicesSpec(BaseModel):
    id: Optional[str]


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


CreateTemplate.model_rebuild()
CreateTemplateCreateTemplate.model_rebuild()
CreateTemplateCreateTemplateServices.model_rebuild()
