# Generated by "invoke backend.generate", do not edit directly

from __future__ import annotations

from typing import TYPE_CHECKING, Optional, Protocol, Union, runtime_checkable

if TYPE_CHECKING:
    from datetime import datetime

    from infrahub_sdk.node import RelatedNode, RelatedNodeSync, RelationshipManager, RelationshipManagerSync


@runtime_checkable
class CoreNode(Protocol):
    id: str
    display_label: Optional[str]
    hfid: Optional[list[str]]
    hfid_str: Optional[str]

    def get_kind(self) -> str: ...


class BuiltinIPAddress(CoreNode):
    address: str
    description: str
    ip_namespace: Union[RelatedNode, RelatedNodeSync]
    ip_prefix: Union[RelatedNode, RelatedNodeSync]


class BuiltinIPNamespace(CoreNode):
    name: str
    description: str
    ip_prefixes: Union[RelationshipManager, RelationshipManagerSync]
    ip_addresses: Union[RelationshipManager, RelationshipManagerSync]


class BuiltinIPPrefix(CoreNode):
    prefix: str
    description: str
    member_type: str
    is_pool: bool
    is_top_level: bool
    utilization: int
    netmask: str
    hostmask: str
    network_address: str
    broadcast_address: str
    ip_namespace: Union[RelatedNode, RelatedNodeSync]
    ip_addresses: Union[RelationshipManager, RelationshipManagerSync]
    resource_pool: Union[RelationshipManager, RelationshipManagerSync]
    parent: Union[RelatedNode, RelatedNodeSync]
    children: Union[RelationshipManager, RelationshipManagerSync]


class CoreArtifactTarget(CoreNode):
    artifacts: Union[RelationshipManager, RelationshipManagerSync]


class CoreCheck(CoreNode):
    name: str
    label: str
    origin: str
    kind: str
    message: str
    conclusion: str
    severity: str
    created_at: datetime
    validator: Union[RelatedNode, RelatedNodeSync]


class CoreComment(CoreNode):
    text: str
    created_at: datetime
    created_by: Union[RelatedNode, RelatedNodeSync]


class CoreGenericRepository(CoreNode):
    name: str
    description: str
    location: str
    username: str
    password: str
    tags: Union[RelationshipManager, RelationshipManagerSync]
    transformations: Union[RelationshipManager, RelationshipManagerSync]
    queries: Union[RelationshipManager, RelationshipManagerSync]
    checks: Union[RelationshipManager, RelationshipManagerSync]
    generators: Union[RelationshipManager, RelationshipManagerSync]


class CoreGroup(CoreNode):
    name: str
    label: str
    description: str
    members: Union[RelationshipManager, RelationshipManagerSync]
    subscribers: Union[RelationshipManager, RelationshipManagerSync]
    parent: Union[RelatedNode, RelatedNodeSync]
    children: Union[RelationshipManager, RelationshipManagerSync]


class CoreProfile(CoreNode):
    profile_name: str
    profile_priority: int


class CoreResourcePool(CoreNode):
    name: str
    description: str


class CoreTaskTarget(CoreNode):
    pass


class CoreThread(CoreNode):
    label: str
    resolved: bool
    created_at: datetime
    change: Union[RelatedNode, RelatedNodeSync]
    comments: Union[RelationshipManager, RelationshipManagerSync]
    created_by: Union[RelatedNode, RelatedNodeSync]


class CoreTransformation(CoreNode):
    name: str
    label: str
    description: str
    timeout: int
    query: Union[RelatedNode, RelatedNodeSync]
    repository: Union[RelatedNode, RelatedNodeSync]
    tags: Union[RelationshipManager, RelationshipManagerSync]


class CoreValidator(CoreNode):
    label: str
    state: str
    conclusion: str
    completed_at: datetime
    started_at: datetime
    proposed_change: Union[RelatedNode, RelatedNodeSync]
    checks: Union[RelationshipManager, RelationshipManagerSync]


class CoreWebhook(CoreNode):
    name: str
    description: str
    url: str
    validate_certificates: bool


class LineageOwner(CoreNode):
    pass


class LineageSource(CoreNode):
    pass


class BuiltinTag(CoreNode):
    name: str
    description: str


class CoreAccount(LineageOwner, LineageSource):
    name: str
    password: str
    label: str
    description: str
    type: str
    role: str
    tokens: Union[RelationshipManager, RelationshipManagerSync]


class CoreArtifact(CoreTaskTarget):
    name: str
    status: str
    content_type: str
    checksum: str
    storage_id: str
    parameters: dict
    object: Union[RelatedNode, RelatedNodeSync]
    definition: Union[RelatedNode, RelatedNodeSync]


class CoreArtifactCheck(CoreCheck):
    changed: bool
    checksum: str
    artifact_id: str
    storage_id: str
    line_number: int


class CoreArtifactDefinition(CoreTaskTarget):
    name: str
    artifact_name: str
    description: str
    parameters: dict
    content_type: str
    targets: Union[RelatedNode, RelatedNodeSync]
    transformation: Union[RelatedNode, RelatedNodeSync]


class CoreArtifactThread(CoreThread):
    artifact_id: str
    storage_id: str
    line_number: int


class CoreArtifactValidator(CoreValidator):
    definition: Union[RelatedNode, RelatedNodeSync]


class CoreChangeComment(CoreComment):
    change: Union[RelatedNode, RelatedNodeSync]


class CoreChangeThread(CoreThread):
    pass


class CoreCheckDefinition(CoreTaskTarget):
    name: str
    description: str
    file_path: str
    class_name: str
    timeout: int
    parameters: dict
    repository: Union[RelatedNode, RelatedNodeSync]
    query: Union[RelatedNode, RelatedNodeSync]
    targets: Union[RelatedNode, RelatedNodeSync]
    tags: Union[RelationshipManager, RelationshipManagerSync]


class CoreCustomWebhook(CoreWebhook, CoreTaskTarget):
    transformation: Union[RelatedNode, RelatedNodeSync]


class CoreDataCheck(CoreCheck):
    conflicts: dict
    keep_branch: str


class CoreDataValidator(CoreValidator):
    pass


class CoreFileCheck(CoreCheck):
    files: list
    commit: str


class CoreFileThread(CoreThread):
    file: str
    commit: str
    line_number: int
    repository: Union[RelatedNode, RelatedNodeSync]


class CoreGeneratorCheck(CoreCheck):
    instance: str


class CoreGeneratorDefinition(CoreTaskTarget):
    name: str
    description: str
    parameters: dict
    file_path: str
    class_name: str
    convert_query_response: bool
    query: Union[RelatedNode, RelatedNodeSync]
    repository: Union[RelatedNode, RelatedNodeSync]
    targets: Union[RelatedNode, RelatedNodeSync]


class CoreGeneratorGroup(CoreGroup):
    pass


class CoreGeneratorInstance(CoreTaskTarget):
    name: str
    status: str
    object: Union[RelatedNode, RelatedNodeSync]
    definition: Union[RelatedNode, RelatedNodeSync]


class CoreGeneratorValidator(CoreValidator):
    definition: Union[RelatedNode, RelatedNodeSync]


class CoreGraphQLQuery(CoreNode):
    name: str
    description: str
    query: str
    variables: dict
    operations: list
    models: list
    depth: int
    height: int
    repository: Union[RelatedNode, RelatedNodeSync]
    tags: Union[RelationshipManager, RelationshipManagerSync]


class CoreGraphQLQueryGroup(CoreGroup):
    parameters: dict
    query: Union[RelatedNode, RelatedNodeSync]


class CoreIPAddressPool(CoreResourcePool, LineageSource):
    default_address_type: str
    default_prefix_length: int
    resources: Union[RelationshipManager, RelationshipManagerSync]
    ip_namespace: Union[RelatedNode, RelatedNodeSync]


class CoreIPPrefixPool(CoreResourcePool, LineageSource):
    default_prefix_length: int
    default_member_type: str
    default_prefix_type: str
    resources: Union[RelationshipManager, RelationshipManagerSync]
    ip_namespace: Union[RelatedNode, RelatedNodeSync]


class CoreNumberPool(CoreResourcePool, LineageSource):
    node: str
    node_attribute: str
    start_range: int
    end_range: int


class CoreObjectThread(CoreThread):
    object_path: str


class CoreProposedChange(CoreTaskTarget):
    name: str
    description: str
    source_branch: str
    destination_branch: str
    state: str
    approved_by: Union[RelationshipManager, RelationshipManagerSync]
    reviewers: Union[RelationshipManager, RelationshipManagerSync]
    created_by: Union[RelatedNode, RelatedNodeSync]
    comments: Union[RelationshipManager, RelationshipManagerSync]
    threads: Union[RelationshipManager, RelationshipManagerSync]
    validations: Union[RelationshipManager, RelationshipManagerSync]


class CoreReadOnlyRepository(LineageOwner, LineageSource, CoreGenericRepository, CoreTaskTarget):
    ref: str
    commit: str


class CoreRepository(LineageOwner, LineageSource, CoreGenericRepository, CoreTaskTarget):
    default_branch: str
    commit: str


class CoreRepositoryValidator(CoreValidator):
    repository: Union[RelatedNode, RelatedNodeSync]


class CoreSchemaCheck(CoreCheck):
    conflicts: dict


class CoreSchemaValidator(CoreValidator):
    pass


class CoreStandardCheck(CoreCheck):
    pass


class CoreStandardGroup(CoreGroup):
    pass


class CoreStandardWebhook(CoreWebhook, CoreTaskTarget):
    shared_key: str


class CoreThreadComment(CoreComment):
    thread: Union[RelatedNode, RelatedNodeSync]


class CoreTransformJinja2(CoreTransformation):
    template_path: str


class CoreTransformPython(CoreTransformation):
    file_path: str
    class_name: str


class CoreUserValidator(CoreValidator):
    check_definition: Union[RelatedNode, RelatedNodeSync]
    repository: Union[RelatedNode, RelatedNodeSync]


class InternalAccountToken(CoreNode):
    name: str
    token: str
    expiration: datetime
    account: Union[RelatedNode, RelatedNodeSync]


class InternalRefreshToken(CoreNode):
    expiration: datetime
    account: Union[RelatedNode, RelatedNodeSync]


class IpamNamespace(BuiltinIPNamespace):
    default: bool
