# generated by datamodel-codegen:
#   filename:  models_json.json
#   timestamp: 2025-12-17T09:27:44+00:00

from __future__ import annotations

from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Union

from pydantic import AwareDatetime, BaseModel, Field


class Acl(BaseModel):
    pass


class Asset(BaseModel):
    id: Optional[int] = Field(None, title='Id')
    vendor: Optional[str] = Field('cisco', title='Vendor')
    serial_number: Optional[str] = Field('abc123', title='Serial Number')
    os: Optional[str] = Field('ios', title='Os')
    os_version: Optional[str] = Field('12.0.1', title='Os Version')
    hardware_model: Optional[str] = Field('', title='Hardware Model')
    ned_id: Optional[str] = Field(None, title='Ned Id')


class AssetCluster(BaseModel):
    id: Optional[int] = Field(None, title='Id')
    name: str = Field(..., title='Name')


class AssetClusterCreate(BaseModel):
    name: str = Field(..., title='Name')


class AssetRefType(Enum):
    asset = 'asset'
    assetcluster = 'assetcluster'


class AssetResponse(BaseModel):
    id: Optional[int] = Field(None, title='Id')
    vendor: Optional[str] = Field('cisco', title='Vendor')
    serial_number: Optional[str] = Field('abc123', title='Serial Number')
    os: Optional[str] = Field('ios', title='Os')
    os_version: Optional[str] = Field('12.0.1', title='Os Version')
    hardware_model: Optional[str] = Field('', title='Hardware Model')
    ned_id: Optional[str] = Field(None, title='Ned Id')
    meta_data: Optional[Dict[str, Any]] = Field(None, title='Meta Data')


class Value(Enum):
    access = 'access'
    trunk = 'trunk'


class AuthorizedKeyAlgorithms(Enum):
    ssh_ed25519 = 'ssh-ed25519'
    ecdsa_sha2_nistp256 = 'ecdsa-sha2-nistp256'
    ecdsa_sha2_nistp384 = 'ecdsa-sha2-nistp384'
    ecdsa_sha2_nistp521 = 'ecdsa-sha2-nistp521'
    rsa_sha2_256 = 'rsa-sha2-256'
    rsa_sha2_512 = 'rsa-sha2-512'
    sk_ssh_ed25519_openssh_com = 'sk-ssh-ed25519@openssh.com'
    sk_ecdsa_sha2_nistp256_openssh_com = 'sk-ecdsa-sha2-nistp256@openssh.com'
    ssh_rsa = 'ssh-rsa'
    ssh_dss = 'ssh-dss'


class ConnectionType(Enum):
    ssh = 'ssh'
    telnet = 'telnet'


class Console(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    line_number: Optional[int] = Field(None, title='Line Number')
    logging_synchronous: Optional[bool] = Field(True, title='Logging Synchronous')


class DeviceConfig(BaseModel):
    node_instance_id: str = Field(..., title='Node Instance Id')
    content: str = Field(..., title='Content')


class EVType(Enum):
    data = 'data'
    resource = 'resource'


class ExternalValue(BaseModel):
    attr_ptr: Optional[str] = Field(None, title='Attr Ptr')
    query: Optional[str] = Field('{"json_query": "in_stringformat"}', title='Query')
    value: Optional[str] = Field(None, title='Value')
    kind: str = Field(..., title='Kind')
    ev_type: Optional[str] = None
    plugin: str = Field(..., title='Plugin')
    resolved: Optional[bool] = Field(False, title='Resolved')
    resolved_at: Optional[AwareDatetime] = Field(None, title='Resolved At')


class Lldp(BaseModel):
    pass


class LoggingFacility(Enum):
    KERN = 'KERN'
    USER = 'USER'
    DAEMON = 'DAEMON'
    AUTHORIZATION = 'AUTHORIZATION'
    FTP = 'FTP'
    NTP = 'NTP'
    DFC = 'DFC'
    EXTERNAL = 'EXTERNAL'
    FIREWALL = 'FIREWALL'
    PFE = 'PFE'
    CONFLICTLOG = 'CONFLICTLOG'
    CHANGELOG = 'CHANGELOG'
    INTERACTIVE_COMMANDS = 'INTERACTIVE_COMMANDS'


class LoggingSeverity(Enum):
    EMERGENCY = 'EMERGENCY'
    ALERT = 'ALERT'
    CRITICAL = 'CRITICAL'
    ERROR = 'ERROR'
    WARNING = 'WARNING'
    NOTICE = 'NOTICE'
    INFORMATIONAL = 'INFORMATIONAL'
    DEBUG = 'DEBUG'


class LogicalNode(BaseModel):
    hostname: Optional[str] = Field('R1', title='Hostname')
    role: Optional[str] = Field('core', title='Role')
    site: Optional[str] = Field('HQ', title='Site')
    sequence: Optional[int] = Field(1, title='Sequence')
    id: Optional[int] = Field(None, title='Id')


class ManagementConnectionBase(BaseModel):
    primary: Optional[bool] = Field(True, title='Primary')
    node_id: int = Field(..., title='Node Id')
    connection_type: Optional[ConnectionType] = 'ssh'
    target_ip: Optional[str] = Field(None, title='Target Ip')


class ManagementConnectionResponse(BaseModel):
    primary: Optional[bool] = Field(None, title='Primary')
    node_id: Optional[int] = Field(None, title='Node Id')
    connection_type: Optional[ConnectionType] = None
    target_ip: Optional[str] = Field(None, title='Target Ip')
    id: Optional[int] = Field(None, title='Id')


class MetadataValueType(Enum):
    concrete = 'concrete'
    externalValue = 'externalValue'
    reference = 'reference'


class Node(BaseModel):
    asset_ref_id: int = Field(..., title='Asset Ref Id')
    asset_ref_type: Optional[AssetRefType] = 'asset'
    logical_node_id: int = Field(..., title='Logical Node Id')
    id: Optional[int] = Field(None, title='Id')


class RouteTarget(BaseModel):
    value: str = Field(..., title='Value')


class StoredDeviceConfig(BaseModel):
    node_instance_id: str = Field(..., title='Node Instance Id')
    content: str = Field(..., title='Content')
    id: Optional[int] = Field(None, title='Id')
    hash: str = Field(..., title='Hash')
    created_at: Optional[AwareDatetime] = Field(None, title='Created At')


class TripleA(BaseModel):
    pass


class ValidationError(BaseModel):
    loc: List[Union[str, int]] = Field(..., title='Location')
    msg: str = Field(..., title='Message')
    type: str = Field(..., title='Error Type')


class VtyLine(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    line_number: Optional[int] = Field(None, title='Line Number')
    logging_synchronous: Optional[bool] = Field(True, title='Logging Synchronous')
    transport_input: Optional[str] = Field('ssh', title='Transport Input')


class AttributeValueListInt(BaseModel):
    value: Union[List[int], ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


class AttributeValueLiteralAccessTrunk(BaseModel):
    value: Union[Value, ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


class AttributeValueLoggingSeverity(BaseModel):
    value: Union[LoggingSeverity, ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


class AttributeValueBool(BaseModel):
    value: Union[bool, ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


class AttributeValueInt(BaseModel):
    value: Union[int, ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


class AttributeValueStr(BaseModel):
    value: Union[str, ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


class AuthorizedKey(BaseModel):
    algorithm: AuthorizedKeyAlgorithms
    public_key: str = Field(..., title='Public Key')


class FileLogging(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    filename: Optional[str] = Field(None, title='Filename')
    rotate: Optional[int] = Field(None, title='Rotate')
    max_size: Optional[int] = Field(None, title='Max Size')
    min_size: Optional[int] = Field(None, title='Min Size')
    facility: LoggingFacility
    severity: LoggingSeverity


class HTTPValidationError(BaseModel):
    detail: Optional[List[ValidationError]] = Field(None, title='Detail')


class ImportExportPolicy(BaseModel):
    export_route_target: Optional[List[RouteTarget]] = Field(
        None, title='Export Route Target'
    )
    import_route_target: Optional[List[RouteTarget]] = Field(
        None, title='Import Route Target'
    )


class InterInstancePolicy(BaseModel):
    import_export_policy: ImportExportPolicy


class LoggingConfig(BaseModel):
    rate_limit: Optional[AttributeValueInt] = None
    severity: Optional[AttributeValueLoggingSeverity] = None
    buffer_size: Optional[AttributeValueInt] = 4096


class LoggingEvent(BaseModel):
    enabled: bool = Field(..., title='Enabled')
    severity: LoggingSeverity


class LoggingEvents(BaseModel):
    events: Optional[Dict[str, LoggingEvent]] = Field({}, title='Events')


class Metadata(BaseModel):
    type: Optional[str] = Field('str', title='Type')
    value_source: Optional[MetadataValueType] = 'concrete'


class NtpConfig(BaseModel):
    enabled: Optional[AttributeValueBool] = False


class NtpServer(BaseModel):
    address: AttributeValueStr
    port: Optional[AttributeValueInt] = None
    version: Optional[AttributeValueInt] = None
    association_typ: Optional[AttributeValueStr] = None
    prefer: Optional[AttributeValueBool] = None
    source_interface: Optional[AttributeValueStr] = None


class Reference(BaseModel):
    pointer: str = Field(..., title='Pointer')
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'reference'}
        )
    )


class RemoteServer(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    host: Optional[str] = Field(None, title='Host')
    port: Optional[int] = Field(514, title='Port')
    transfer: Optional[str] = Field('udp', title='Transfer')
    source_address: Optional[AttributeValueStr] = None


class SoftwareLoopbackInterface(BaseModel):
    index: AttributeValueInt
    name: AttributeValueStr
    description: Optional[AttributeValueStr] = None
    enabled: Optional[AttributeValueBool] = None
    ipv4: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'concrete'}
        )
    )
    type: Literal['softwareLoopback'] = Field('softwareLoopback', title='Type')
    vlan_id: Optional[int] = Field(None, title='Vlan Id')


class SshServer(BaseModel):
    enable: Optional[AttributeValueBool] = None
    protocol_version: Optional[AttributeValueInt] = 2
    timeout: Optional[AttributeValueInt] = None
    auth_retries: Optional[AttributeValueInt] = None
    source_interface: Optional[Reference] = None


class SubInterface(BaseModel):
    index: AttributeValueInt
    name: AttributeValueStr
    description: Optional[AttributeValueStr] = None
    enabled: Optional[AttributeValueBool] = None
    ipv4: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'concrete'}
        )
    )
    type: Literal['subinterface'] = Field('subinterface', title='Type')
    vlan_id: Optional[int] = Field(None, title='Vlan Id')


class SystemConfig(BaseModel):
    contact: Optional[AttributeValueStr] = None
    domain_name: Optional[AttributeValueStr] = None
    hostname: Optional[AttributeValueStr] = None
    location: Optional[AttributeValueStr] = None


class Vlan(BaseModel):
    name: AttributeValueStr
    vlan_id: Optional[AttributeValueInt] = None
    vlan_name: Optional[AttributeValueStr] = None
    network_instance: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = None


class EthernetCsmacdInterface(BaseModel):
    index: AttributeValueInt
    name: AttributeValueStr
    description: Optional[AttributeValueStr] = None
    enabled: Optional[AttributeValueBool] = None
    ipv4: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'concrete'}
        )
    )
    type: Literal['ethernetCsmacd'] = Field('ethernetCsmacd', title='Type')
    subinterfaces: Optional[List[SubInterface]] = Field(None, title='Subinterfaces')
    speed: Optional[AttributeValueInt] = None
    duplex: Optional[AttributeValueStr] = None
    switchport: Optional[AttributeValueBool] = None
    switchport_mode: Optional[AttributeValueLiteralAccessTrunk] = None
    trunk_allowed_vlans: Optional[AttributeValueListInt] = None
    native_vlan: Optional[AttributeValueInt] = None
    access_vlan: Optional[AttributeValueInt] = None
    vlan_id: Optional[AttributeValueInt] = None
    voice_vlan: Optional[AttributeValueInt] = None
    mtu: Optional[AttributeValueInt] = None


class Ieee8023adLagInterface(BaseModel):
    index: AttributeValueInt
    name: AttributeValueStr
    description: Optional[AttributeValueStr] = None
    enabled: Optional[AttributeValueBool] = None
    ipv4: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'concrete'}
        )
    )
    type: Literal['ieee8023adLag'] = Field('ieee8023adLag', title='Type')
    members: Optional[List[str]] = Field(None, title='Members')


class L3IpvlanInterface(BaseModel):
    index: AttributeValueInt
    name: AttributeValueStr
    description: Optional[AttributeValueStr] = None
    enabled: Optional[AttributeValueBool] = None
    ipv4: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'concrete'}
        )
    )
    type: Literal['l3ipvlan'] = Field('l3ipvlan', title='Type')
    vlan_id: Optional[int] = Field(None, title='Vlan Id')


class LoggingComponents(BaseModel):
    config: Optional[LoggingConfig] = Field(
        default_factory=lambda: LoggingConfig.model_validate({'buffer_size': 4096})
    )
    console: Optional[Console] = None
    remote_servers: Optional[Dict[str, RemoteServer]] = Field(
        {}, title='Remote Servers'
    )
    events: Optional[LoggingEvents] = None
    vty: Optional[Dict[str, VtyLine]] = Field({}, title='Vty')
    files: Optional[Dict[str, FileLogging]] = Field({}, title='Files')


class ManagementInterface(BaseModel):
    index: AttributeValueInt
    name: AttributeValueStr
    description: Optional[AttributeValueStr] = None
    enabled: Optional[AttributeValueBool] = None
    ipv4: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'concrete'}
        )
    )
    type: Literal['managementInterface'] = Field('managementInterface', title='Type')
    vlan_id: Optional[int] = Field(None, title='Vlan Id')


class NetworkInstance(BaseModel):
    name: AttributeValueStr
    description: Optional[AttributeValueStr] = None
    vlans: Optional[Dict[str, Vlan]] = Field({}, title='Vlans')
    interfaces: Optional[Dict[str, Reference]] = Field({}, title='Interfaces')
    inter_instance_policies: Optional[Dict[str, InterInstancePolicy]] = Field(
        {}, title='Inter Instance Policies'
    )


class Ntp(BaseModel):
    config: Optional[NtpConfig] = Field(
        default_factory=lambda: NtpConfig.model_validate({'enabled': False})
    )
    servers: Optional[Dict[str, NtpServer]] = Field({}, title='Servers')


class Ssh(BaseModel):
    config: Optional[SshServer] = None
    host_keys: Optional[Dict[str, AuthorizedKey]] = Field({}, title='Host Keys')


class System(BaseModel):
    config: Optional[SystemConfig] = {}
    aaa: Optional[TripleA] = {}
    logging: Optional[LoggingComponents] = Field(
        default_factory=lambda: LoggingComponents.model_validate(
            {
                'config': {'buffer_size': 4096},
                'remote_servers': {},
                'vty': {},
                'files': {},
            }
        )
    )
    ntp: Optional[Ntp] = Field(
        default_factory=lambda: Ntp.model_validate(
            {'config': {'enabled': False}, 'servers': {}}
        )
    )
    ssh: Optional[Ssh] = Field(
        default_factory=lambda: Ssh.model_validate({'host_keys': {}})
    )


class ComposedConfiguration(BaseModel):
    system: Optional[System] = Field(
        default_factory=lambda: System.model_validate(
            {
                'config': {},
                'aaa': {},
                'logging': {
                    'config': {'buffer_size': 4096},
                    'files': {},
                    'remote_servers': {},
                    'vty': {},
                },
                'ntp': {'config': {'enabled': False}, 'servers': {}},
                'ssh': {'host_keys': {}},
            }
        )
    )
    acl: Optional[Acl] = {}
    lldp: Optional[Lldp] = {}
    interfaces: Optional[
        Dict[
            str,
            Union[
                EthernetCsmacdInterface,
                Ieee8023adLagInterface,
                L3IpvlanInterface,
                SoftwareLoopbackInterface,
                SubInterface,
                ManagementInterface,
            ],
        ]
    ] = Field({}, title='Interfaces')
    network_instances: Optional[Dict[str, NetworkInstance]] = Field(
        default_factory=lambda: NetworkInstance.model_validate(
            {
                'global': {
                    'inter_instance_policies': {},
                    'interfaces': {},
                    'name': {
                        'metadata': {'type': 'str', 'value_type': 'concrete'},
                        'value': 'global',
                    },
                    'vlans': {},
                }
            }
        ),
        title='Network Instances',
    )


class LogicalNodeResponse(BaseModel):
    hostname: Optional[str] = Field('R1', title='Hostname')
    role: Optional[str] = Field('core', title='Role')
    site: Optional[str] = Field('HQ', title='Site')
    sequence: Optional[int] = Field(1, title='Sequence')
    id: Optional[int] = Field(None, title='Id')
    configuration: Optional[ComposedConfiguration] = Field(
        default_factory=lambda: ComposedConfiguration.model_validate(
            {
                'system': {
                    'aaa': {},
                    'config': {},
                    'logging': {
                        'config': {'buffer_size': 4096},
                        'files': {},
                        'remote_servers': {},
                        'vty': {},
                    },
                    'ntp': {'config': {'enabled': False}, 'servers': {}},
                    'ssh': {'host_keys': {}},
                },
                'acl': {},
                'lldp': {},
                'interfaces': {},
                'network_instances': {
                    'global': {
                        'inter_instance_policies': {},
                        'interfaces': {},
                        'name': {
                            'metadata': {'type': 'str', 'value_type': 'concrete'},
                            'value': 'global',
                        },
                        'vlans': {},
                    }
                },
            }
        )
    )
    meta_data: Optional[Dict[str, Any]] = Field(None, title='Meta Data')
