# generated by datamodel-codegen:
#   filename:  models_json.json
#   timestamp: 2026-02-12T10:16: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 Value1(Enum):
    active = 'active'
    passive = 'passive'
    on = 'on'
    auto = 'auto'


class Value2(Enum):
    fast = 'fast'
    slow = 'slow'


class Value3(Enum):
    v2c = 'v2c'
    v3 = 'v3'


class ValueEnum(Enum):
    src_mac = 'src-mac'
    dst_mac = 'dst-mac'
    src_dst_mac = 'src-dst-mac'
    src_ip = 'src-ip'
    dst_ip = 'dst-ip'
    src_dst_ip = 'src-dst-ip'
    src_port = 'src-port'
    dst_port = 'dst-port'
    src_dst_port = 'src-dst-port'


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 ConfigOutput(Enum):
    parsed = 'parsed'
    rendered = 'rendered'


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 StpLinkType(Enum):
    point_to_point = 'point-to-point'
    shared = 'shared'


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 Type(Enum):
    ethernetCsmacd = 'ethernetCsmacd'
    ieee8023adLag = 'ieee8023adLag'
    l3ipvlan = 'l3ipvlan'
    softwareLoopback = 'softwareLoopback'
    subinterface = 'subinterface'
    managementInterface = 'managementInterface'


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 Ned(BaseModel):
    name: str = Field(..., title='Name')
    package_name: str = Field(..., title='Package Name')
    version: str = Field(..., title='Version')
    description: str = Field(..., title='Description')
    filename: str = Field(..., title='Filename')


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 RstpAttributes(BaseModel):
    hello_time: Optional[int] = Field(None, title='Hello Time')
    max_age: Optional[int] = Field(None, title='Max Age')
    forward_delay: Optional[int] = Field(None, title='Forward Delay')
    bridge_priority: Optional[int] = Field(None, title='Bridge Priority')
    hold_count: Optional[int] = Field(None, title='Hold Count')


class SnmpAccess(Enum):
    READ_ONLY = 'READ_ONLY'
    READ_WRITE = 'READ_WRITE'


class SnmpAuthProtocol(Enum):
    MD5 = 'MD5'
    SHA = 'SHA'
    SHA_224 = 'SHA-224'
    SHA_256 = 'SHA-256'
    SHA_384 = 'SHA-384'
    SHA_512 = 'SHA-512'


class SnmpPrivProtocol(Enum):
    DES = 'DES'
    field_3DES = '3DES'
    AES128 = 'AES128'
    AES192 = 'AES192'
    AES256 = 'AES256'


class SnmpSecurityLevel(Enum):
    NO_AUTH_NO_PRIV = 'NO_AUTH_NO_PRIV'
    AUTH_NO_PRIV = 'AUTH_NO_PRIV'
    AUTH_PRIV = 'AUTH_PRIV'


class SpanningTreeGlobalAttributes(BaseModel):
    mode: Optional[str] = Field(None, title='Mode')
    bpdu_filter: Optional[bool] = Field(False, title='Bpdu Filter')
    bpdu_guard: Optional[bool] = Field(False, title='Bpdu Guard')
    loop_guard: Optional[bool] = Field(False, title='Loop Guard')
    portfast: Optional[bool] = Field(False, title='Portfast')
    bridge_assurance: Optional[bool] = Field(False, title='Bridge Assurance')


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 TrapEventOptions(Enum):
    vrf_up = 'vrf-up'
    vrf_down = 'vrf-down'
    vnet_trunk_up = 'vnet-trunk-up'
    vnet_trunk_down = 'vnet-trunk-down'
    all = 'all'
    enabled = 'enabled'
    enabled_1 = 'enabled'
    enabled_2 = 'enabled'
    change = 'change'
    move = 'move'
    threshold = 'threshold'
    authentication = 'authentication'
    linkdown = 'linkdown'
    linkup = 'linkup'
    coldstart = 'coldstart'
    warmstart = 'warmstart'
    trapflowmonevent = 'trapflowmonevent'
    trapentityperfevent = 'trapentityperfevent'
    trapcallhomeevent_MESSAGE_SEND_FAIL = 'trapcallhomeevent_MESSAGE_SEND_FAIL'
    trapcallhomeevent_SERVER_FAIL = 'trapcallhomeevent_SERVER_FAIL'
    trapttyevent = 'trapttyevent'
    trapeigrpevent = 'trapeigrpevent'
    ospf_state_change = 'ospf_state_change'
    ospf_errors = 'ospf_errors'
    ospf_retransmit = 'ospf_retransmit'
    ospf_lsa = 'ospf_lsa'
    ospf_cisco_trans_change = 'ospf_cisco_trans_change'
    ospf_cisco_shamlink_interface = 'ospf_cisco_shamlink_interface'
    ospf_cisco_shamlink_neighbor = 'ospf_cisco_shamlink_neighbor'
    bfd_event = 'bfd_event'
    cisco_smart_license_event = 'cisco_smart_license_event'
    auth_framework_sec_violation = 'auth_framework_sec_violation'
    rep_event = 'rep_event'
    memory_bufferpeak = 'memory_bufferpeak'
    config_copy = 'config_copy'
    config = 'config'
    config_ctid = 'config_ctid'
    energy_wise_event = 'energy_wise_event'
    fru_ctrl_event = 'fru_ctrl_event'
    entity_event = 'entity_event'
    flash_insertion = 'flash_insertion'
    flash_removal = 'flash_removal'
    flash_lowspace = 'flash_lowspace'
    power_ethernet_police = 'power_ethernet_police'
    power_ethernet_group_threshold = 'power_ethernet_group_threshold'
    cpu_threshold = 'cpu_threshold'
    syslog = 'syslog'
    udld_link_fail_rpt = 'udld_link_fail_rpt'
    udld_status_change = 'udld_status_change'
    vtp_event = 'vtp_event'
    vlancreate = 'vlancreate'
    vlandelete = 'vlandelete'
    port_security = 'port_security'
    env_mon = 'env_mon'
    stackwise = 'stackwise'
    mvpn = 'mvpn'
    pw_vc = 'pw_vc'
    ipsla = 'ipsla'
    dhcp = 'dhcp'
    event_manager = 'event_manager'
    ike_policy_add = 'ike_policy_add'
    ike_policy_delete = 'ike_policy_delete'
    ike_tunnel_start = 'ike_tunnel_start'
    ike_tunnel_stop = 'ike_tunnel_stop'
    ipsec_cryptomap_add = 'ipsec_cryptomap_add'
    ipsec_cryptomap_delete = 'ipsec_cryptomap_delete'
    ipsec_cryptomap_attach = 'ipsec_cryptomap_attach'
    ipsec_cryptomap_detach = 'ipsec_cryptomap_detach'
    ipsec_tunnel_start = 'ipsec_tunnel_start'
    ipsec_tunnel_stop = 'ipsec_tunnel_stop'
    ipsec_too_many_sas = 'ipsec_too_many_sas'
    ospfv3_state_change = 'ospfv3_state_change'
    ospfv3_errors = 'ospfv3_errors'
    ip_multicast = 'ip_multicast'
    msdp = 'msdp'
    pim_neighbor_change = 'pim_neighbor_change'
    pim_rp_mapping_change = 'pim_rp_mapping_change'
    invalid_pim_message = 'invalid_pim_message'
    bridge_newroot = 'bridge_newroot'
    bridge_topologychange = 'bridge_topologychange'
    stpx_inconsistency = 'stpx_inconsistency'
    stpx_root_inconsistency = 'stpx_root_inconsistency'
    stpx_loop_inconsistency = 'stpx_loop_inconsistency'
    bgp_cbg2 = 'bgp_cbg2'
    hsrp = 'hsrp'
    isis = 'isis'
    cef_resource_failure = 'cef_resource_failure'
    cef_peer_state_change = 'cef_peer_state_change'
    cef_peer_fib_state_change = 'cef_peer_fib_state_change'
    cef_inconsistency = 'cef_inconsistency'
    lisp = 'lisp'
    nhrp_nhs = 'nhrp_nhs'
    nhrp_nhc = 'nhrp_nhc'
    nhrp_nhp = 'nhrp_nhp'
    nhrp_quota_exceeded = 'nhrp_quota_exceeded'
    local_auth = 'local_auth'
    entity_diag_boot_up_fail = 'entity_diag_boot_up_fail'
    entity_diag_hm_test_recover = 'entity_diag_hm_test_recover'
    entity_diag_hm_thresh_reached = 'entity_diag_hm_thresh_reached'
    entity_diag_scheduled_test_fail = 'entity_diag_scheduled_test_fail'
    mpls_rfc_ldp = 'mpls_rfc_ldp'
    mpls_ldp = 'mpls_ldp'
    mpls_rfc_traffic_eng = 'mpls_rfc_traffic_eng'
    mpls_traffic_eng = 'mpls_traffic_eng'
    mpls_fast_reroute_protected = 'mpls_fast_reroute_protected'
    mpls_vpn = 'mpls_vpn'
    mpls_rfc_vpn = 'mpls_rfc_vpn'
    bulkstat_collection = 'bulkstat_collection'
    bulkstat_transfer = 'bulkstat_transfer'


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 AaaAccountingEvents(BaseModel):
    event: Optional[List[Any]] = Field(
        [
            {
                'event-type': 'command',
                'config': {'event-type': 'command', 'method': ['tacacs_group']},
            },
            {
                'event-type': 'system',
                'config': {'event-type': 'system', 'method': ['tacacs_group']},
            },
        ],
        title='Event',
    )


class AaaAccountingMethods(BaseModel):
    method: Optional[List[str]] = Field(None, title='Method')


class AaaAuthenticationMethods(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    method: Optional[List[str]] = Field(None, title='Method')


class AaaAuthorizationEvent(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    event_type: Optional[Dict[str, Any]] = Field(
        {'event-type': 'command', 'method': ['tacacs_group']}, title='Event Type'
    )


class AaaAuthorizationEvents(BaseModel):
    event: Optional[Dict[str, AaaAuthorizationEvent]] = Field({}, title='Event')


class AaaAuthorizationMethods(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    method: Optional[List[str]] = Field(None, title='Method')


class AaaRadiusAttributes(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    auth_port: Optional[int] = Field(1812, title='Auth Port')
    acct_port: Optional[int] = Field(1813, title='Acct Port')
    secret_key: Optional[str] = Field(None, title='Secret Key')
    secret_key_hashed: Optional[str] = Field(None, title='Secret Key Hashed')
    address: Optional[str] = Field(None, title='Address')
    timeout: Optional[int] = Field(30, title='Timeout')
    source_address: Optional[str] = Field(None, title='Source Address')
    retransmit_attempts: Optional[int] = Field(3, title='Retransmit Attempts')


class Type1(Enum):
    tacacs = 'tacacs'
    radius = 'radius'


class AaaTacacsAttributes(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    port: Optional[int] = Field(49, title='Port')
    secret_key: Optional[str] = Field(None, title='Secret Key')
    secret_key_hashed: Optional[str] = Field(None, title='Secret Key Hashed')
    address: Optional[str] = Field(None, title='Address')
    timeout: Optional[int] = Field(30, title='Timeout')
    source_address: Optional[str] = Field(None, title='Source Address')


class AdminUser(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    admin_password: Optional[str] = Field(None, title='Admin Password')
    admin_password_hashed: Optional[str] = Field(None, title='Admin Password Hashed')


class AuthenticationUser(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    username: Optional[str] = Field(None, title='Username')
    password: Optional[str] = Field(None, title='Password')
    password_hahsed: Optional[str] = Field(None, title='Password Hahsed')
    ssh_key: Optional[str] = Field(None, title='Ssh Key')
    role: Optional[str] = Field(None, title='Role')


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


class AttributeValueListStr(BaseModel):
    value: Union[List[str], 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 AttributeValueLiteralActivePassiveOnAuto(BaseModel):
    value: Union[Value1, ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


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


class AttributeValueLiteralV2cV3(BaseModel):
    value: Union[Value3, 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 AttributeValueSnmpAccess(BaseModel):
    value: Union[SnmpAccess, ExternalValue] = Field(..., title='Value')
    metadata: Optional[Dict[str, Any]] = Field(None, title='Metadata')


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


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


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


class AttributeValueUnionIntListInt(BaseModel):
    value: Union[int, List[int], 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 AttributeValueListLiteralSrcMacDstMacSrcDstMacSrcIpDstIpSrcDstIpSrcPortDstPortSrcDstPort(
    BaseModel
):
    value: Union[List[ValueEnum], 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 LacpConfig(BaseModel):
    system_priority: Optional[AttributeValueInt] = None
    system_id_mac: Optional[AttributeValueStr] = None
    load_balance_algorithm: Optional[
        AttributeValueListLiteralSrcMacDstMacSrcDstMacSrcIpDstIpSrcDstIpSrcPortDstPortSrcDstPort
    ] = None


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


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 MstpAttributes(BaseModel):
    hello_time: Optional[int] = Field(None, title='Hello Time')
    max_age: Optional[int] = Field(None, title='Max Age')
    forward_delay: Optional[int] = Field(None, title='Forward Delay')
    bridge_priority: Optional[int] = Field(None, title='Bridge Priority')
    hold_count: Optional[int] = Field(None, title='Hold Count')
    revision: Optional[AttributeValueInt] = None
    max_hop: Optional[AttributeValueInt] = None


class MstpInstanceAttributes(BaseModel):
    hello_time: Optional[int] = Field(None, title='Hello Time')
    max_age: Optional[int] = Field(None, title='Max Age')
    forward_delay: Optional[int] = Field(None, title='Forward Delay')
    bridge_priority: Optional[int] = Field(None, title='Bridge Priority')
    hold_count: Optional[int] = Field(None, title='Hold Count')
    instance_id: AttributeValueInt
    name: Optional[AttributeValueStr] = None
    vlan: Optional[AttributeValueListInt] = None


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 RSTPConfig(BaseModel):
    config: Optional[RstpAttributes] = {}


class RapidPVSTAttributes(BaseModel):
    hello_time: Optional[int] = Field(None, title='Hello Time')
    max_age: Optional[int] = Field(None, title='Max Age')
    forward_delay: Optional[int] = Field(None, title='Forward Delay')
    bridge_priority: Optional[int] = Field(None, title='Bridge Priority')
    hold_count: Optional[int] = Field(None, title='Hold Count')
    vlan: Optional[AttributeValueUnionIntListInt] = None


class RapidPVSTConfig(BaseModel):
    vlan: Optional[Dict[str, RapidPVSTAttributes]] = Field({}, title='Vlan')


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 SnmpCommunity(BaseModel):
    name: AttributeValueStr
    community: Optional[AttributeValueStr] = None
    access: Optional[AttributeValueSnmpAccess] = 'READ_ONLY'
    view: Optional[AttributeValueStr] = None
    ipv4_acl: Optional[AttributeValueStr] = None
    ipv6_acl: Optional[AttributeValueStr] = None
    source_interface: Optional[Reference] = None
    clients: Optional[AttributeValueListStr] = None


class SnmpConfig(BaseModel):
    enabled: Optional[AttributeValueBool] = False
    engine_id: Optional[AttributeValueStr] = None
    location: Optional[AttributeValueStr] = None
    contact: Optional[AttributeValueStr] = None


class SnmpServer(BaseModel):
    name: str = Field(..., title='Name')
    address: AttributeValueStr
    port: Optional[AttributeValueInt] = 162
    enabled: Optional[AttributeValueBool] = True
    version: Optional[AttributeValueLiteralV2cV3] = None
    community: Optional[AttributeValueStr] = None
    username: Optional[AttributeValueStr] = None
    security_level: Optional[AttributeValueSnmpSecurityLevel] = None
    source_interface: Optional[Reference] = None
    network_instance: Optional[AttributeValueStr] = None


class SnmpUser(BaseModel):
    username: AttributeValueStr
    security_level: Optional[AttributeValueSnmpSecurityLevel] = 'NO_AUTH_NO_PRIV'
    auth_protocol: Optional[AttributeValueSnmpAuthProtocol] = None
    auth_password: Optional[AttributeValueStr] = None
    priv_protocol: Optional[AttributeValueSnmpPrivProtocol] = None
    priv_password: Optional[AttributeValueStr] = None


class SnmpView(BaseModel):
    name: AttributeValueStr
    oid: AttributeValueStr
    included: Optional[AttributeValueBool] = True


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 TrapEvent(BaseModel):
    name: str = Field(..., title='Name')
    event_name: TrapEventOptions


class Vlan(BaseModel):
    name: AttributeValueStr
    vlan_id: Optional[AttributeValueInt] = None
    vlan_name: Optional[AttributeValueStr] = None
    network_instance: Optional[AttributeValueStr] = None
    metadata: Optional[Metadata] = Field(
        default_factory=lambda: Metadata.model_validate(
            {'type': 'str', 'value_source': 'concrete'}
        )
    )


class AaaAccounting(BaseModel):
    config: Optional[AaaAccountingMethods] = {}
    events: Optional[AaaAccountingEvents] = Field(
        default_factory=lambda: AaaAccountingEvents.model_validate(
            {
                'event': [
                    {
                        'config': {'event-type': 'command', 'method': ['tacacs_group']},
                        'event-type': 'command',
                    },
                    {
                        'config': {'event-type': 'system', 'method': ['tacacs_group']},
                        'event-type': 'system',
                    },
                ]
            }
        )
    )


class AaaAuthenticationAdminUsers(BaseModel):
    config: Optional[Dict[str, AdminUser]] = Field({}, title='Config')


class AaaAuthenticationUsers(BaseModel):
    name: Optional[str] = Field(None, title='Name')
    username: Optional[Dict[str, AuthenticationUser]] = Field({}, title='Username')


class AaaAuthorization(BaseModel):
    config: Optional[Dict[str, AaaAuthorizationMethods]] = Field({}, title='Config')
    events: Optional[Dict[str, AaaAuthorizationEvents]] = Field({}, title='Events')


class AaaServerGroupAttributes(BaseModel):
    enable: Optional[bool] = Field(False, title='Enable')
    type: Optional[Type1] = Field(None, title='Type')
    tacacs: Optional[Reference] = None
    radius: Optional[Reference] = 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')
    stack_index: Optional[AttributeValueInt] = None
    module_index: Optional[AttributeValueInt] = None
    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
    aggregate_id: Optional[AttributeValueInt] = None
    lacp_enabled: Optional[AttributeValueBool] = None
    lacp_mode: Optional[AttributeValueLiteralActivePassiveOnAuto] = None
    lacp_port_priority: Optional[AttributeValueInt] = None
    lacp_interval: Optional[AttributeValueLiteralFastSlow] = None
    stp_port_priority: Optional[int] = Field(None, title='Stp Port Priority')
    stp_cost: Optional[int] = Field(None, title='Stp Cost')
    stp_edge_port: Optional[bool] = Field(False, title='Stp Edge Port')
    stp_bpdu_filter: Optional[bool] = Field(False, title='Stp Bpdu Filter')
    stp_bpdu_guard: Optional[bool] = Field(False, title='Stp Bpdu Guard')
    stp_loop_guard: Optional[bool] = Field(False, title='Stp Loop Guard')
    stp_root_guard: Optional[bool] = Field(False, title='Stp Root Guard')
    stp_portfast: Optional[bool] = Field(False, title='Stp Portfast')
    stp_link_type: Optional[StpLinkType] = Field(None, title='Stp Link Type')


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')
    aggregate_id: Optional[int] = Field(None, title='Aggregate Id')
    members: Optional[List[str]] = Field(None, title='Members')
    max_ports: Optional[AttributeValueInt] = None
    switchport: Optional[AttributeValueBool] = None
    switchport_mode: Optional[AttributeValueLiteralAccessTrunk] = None
    trunk_allowed_vlans: Optional[AttributeValueListInt] = None
    native_vlan: Optional[AttributeValueInt] = None
    mtu: Optional[AttributeValueInt] = None


class Interface(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: Optional[Type] = Field('ethernetCsmacd', title='Type')


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 Lacp(BaseModel):
    config: Optional[LacpConfig] = {}
    interfaces: Optional[Dict[str, Interface]] = Field({}, title='Interfaces')


class LoggingComponents(BaseModel):
    config: Optional[LoggingConfig] = {}
    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 MSTPConfig(BaseModel):
    config: Optional[MstpAttributes] = {}
    mst_instances: Optional[Dict[str, MstpInstanceAttributes]] = Field(
        {}, title='Mst Instances'
    )


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] = None
    servers: Optional[Dict[str, NtpServer]] = Field({}, title='Servers')


class Snmp(BaseModel):
    config: Optional[SnmpConfig] = Field(
        default_factory=lambda: SnmpConfig.model_validate({'enabled': False})
    )
    communities: Optional[Dict[str, SnmpCommunity]] = Field({}, title='Communities')
    users: Optional[Dict[str, SnmpUser]] = Field({}, title='Users')
    trap_servers: Optional[Dict[str, SnmpServer]] = Field({}, title='Trap Servers')
    trap_events: Optional[Dict[str, TrapEvent]] = Field({}, title='Trap Events')
    views: Optional[Dict[str, SnmpView]] = Field({}, title='Views')


class SpanningTree(BaseModel):
    config: Optional[SpanningTreeGlobalAttributes] = Field(
        default_factory=lambda: SpanningTreeGlobalAttributes.model_validate(
            {
                'bpdu_filter': False,
                'bpdu_guard': False,
                'loop_guard': False,
                'portfast': False,
                'bridge_assurance': False,
            }
        )
    )
    rstp: Optional[RSTPConfig] = Field(
        default_factory=lambda: RSTPConfig.model_validate({'config': {}})
    )
    mstp: Optional[MSTPConfig] = Field(
        default_factory=lambda: MSTPConfig.model_validate(
            {'config': {}, 'mst_instances': {}}
        )
    )
    rapidpvst: Optional[RapidPVSTConfig] = Field(
        default_factory=lambda: RapidPVSTConfig.model_validate({'vlan': {}})
    )


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


class AaaAuthentication(BaseModel):
    config: Optional[Dict[str, AaaAuthenticationMethods]] = Field({}, title='Config')
    admin_user: Optional[Dict[str, AaaAuthenticationAdminUsers]] = Field(
        {}, title='Admin User'
    )
    users: Optional[Dict[str, AaaAuthenticationUsers]] = Field({}, title='Users')


class TripleA(BaseModel):
    server_groups: Optional[Dict[str, AaaServerGroupAttributes]] = Field(
        {}, title='Server Groups'
    )
    tacacs: Optional[Dict[str, AaaTacacsAttributes]] = Field({}, title='Tacacs')
    radius: Optional[Dict[str, AaaRadiusAttributes]] = Field({}, title='Radius')
    authentication: Optional[AaaAuthentication] = Field(
        default_factory=lambda: AaaAuthentication.model_validate(
            {'config': {}, 'admin_user': {}, 'users': {}}
        )
    )
    authorization: Optional[AaaAuthorization] = Field(
        default_factory=lambda: AaaAuthorization.model_validate(
            {'config': {}, 'events': {}}
        )
    )
    accounting: Optional[AaaAccounting] = Field(
        default_factory=lambda: AaaAccounting.model_validate(
            {
                'config': {},
                'events': {
                    'event': [
                        {
                            'config': {
                                'event-type': 'command',
                                'method': ['tacacs_group'],
                            },
                            'event-type': 'command',
                        },
                        {
                            'config': {
                                'event-type': 'system',
                                'method': ['tacacs_group'],
                            },
                            'event-type': 'system',
                        },
                    ]
                },
            }
        )
    )


class System(BaseModel):
    config: Optional[SystemConfig] = {}
    aaa: Optional[TripleA] = Field(
        default_factory=lambda: TripleA.model_validate(
            {
                'server_groups': {},
                'tacacs': {},
                'radius': {},
                'authentication': {'admin_user': {}, 'config': {}, 'users': {}},
                'authorization': {'config': {}, 'events': {}},
                'accounting': {
                    'config': {},
                    'events': {
                        'event': [
                            {
                                'config': {
                                    'event-type': 'command',
                                    'method': ['tacacs_group'],
                                },
                                'event-type': 'command',
                            },
                            {
                                'config': {
                                    'event-type': 'system',
                                    'method': ['tacacs_group'],
                                },
                                'event-type': 'system',
                            },
                        ]
                    },
                },
            }
        )
    )
    logging: Optional[LoggingComponents] = Field(
        default_factory=lambda: LoggingComponents.model_validate(
            {'config': {}, 'remote_servers': {}, 'vty': {}, 'files': {}}
        )
    )
    ntp: Optional[Ntp] = Field(
        default_factory=lambda: Ntp.model_validate({'servers': {}})
    )
    ssh: Optional[Ssh] = Field(
        default_factory=lambda: Ssh.model_validate({'host_keys': {}})
    )
    snmp: Optional[Snmp] = Field(
        default_factory=lambda: Snmp.model_validate(
            {
                'config': {'enabled': False},
                'communities': {},
                'users': {},
                'trap_servers': {},
                'trap_events': {},
                'views': {},
            }
        )
    )


class ComposedConfiguration(BaseModel):
    system: Optional[System] = Field(
        default_factory=lambda: System.model_validate(
            {
                'config': {},
                'aaa': {
                    'accounting': {
                        'config': {},
                        'events': {
                            'event': [
                                {
                                    'config': {
                                        'event-type': 'command',
                                        'method': ['tacacs_group'],
                                    },
                                    'event-type': 'command',
                                },
                                {
                                    'config': {
                                        'event-type': 'system',
                                        'method': ['tacacs_group'],
                                    },
                                    'event-type': 'system',
                                },
                            ]
                        },
                    },
                    'authentication': {'admin_user': {}, 'config': {}, 'users': {}},
                    'authorization': {'config': {}, 'events': {}},
                    'radius': {},
                    'server_groups': {},
                    'tacacs': {},
                },
                'logging': {'config': {}, 'files': {}, 'remote_servers': {}, 'vty': {}},
                'ntp': {'servers': {}},
                'ssh': {'host_keys': {}},
                'snmp': {
                    'communities': {},
                    'config': {'enabled': False},
                    'trap_events': {},
                    'trap_servers': {},
                    'users': {},
                    'views': {},
                },
            }
        )
    )
    acl: Optional[Acl] = {}
    lldp: Optional[Lldp] = {}
    lacp: Optional[Lacp] = {}
    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',
    )
    stp: Optional[SpanningTree] = {}


class DeviceConfigResponse(BaseModel):
    node_instance_id: str = Field(..., title='Node Instance Id')
    content: Union[str, ComposedConfiguration] = Field(..., title='Content')
    hash: str = Field(..., title='Hash')
    created_at: AwareDatetime = Field(..., title='Created At')


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': {
                        'accounting': {
                            'config': {},
                            'events': {
                                'event': [
                                    {
                                        'config': {
                                            'event-type': 'command',
                                            'method': ['tacacs_group'],
                                        },
                                        'event-type': 'command',
                                    },
                                    {
                                        'config': {
                                            'event-type': 'system',
                                            'method': ['tacacs_group'],
                                        },
                                        'event-type': 'system',
                                    },
                                ]
                            },
                        },
                        'authentication': {'admin_user': {}, 'config': {}, 'users': {}},
                        'authorization': {'config': {}, 'events': {}},
                        'radius': {},
                        'server_groups': {},
                        'tacacs': {},
                    },
                    'config': {},
                    'logging': {
                        'config': {},
                        'files': {},
                        'remote_servers': {},
                        'vty': {},
                    },
                    'ntp': {'servers': {}},
                    'snmp': {
                        'communities': {},
                        'config': {'enabled': False},
                        'trap_events': {},
                        'trap_servers': {},
                        'users': {},
                        'views': {},
                    },
                    'ssh': {'host_keys': {}},
                },
                'acl': {},
                'lldp': {},
                'lacp': {},
                'interfaces': {},
                'network_instances': {
                    'global': {
                        'inter_instance_policies': {},
                        'interfaces': {},
                        'name': {
                            'metadata': {'type': 'str', 'value_type': 'concrete'},
                            'value': 'global',
                        },
                        'vlans': {},
                    }
                },
                'stp': {},
            }
        )
    )
    meta_data: Optional[Dict[str, Any]] = Field(None, title='Meta Data')


class NodeResponse(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')
    asset: AssetResponse
    logical_node: LogicalNodeResponse
