from .choices import InterfaceTypeChoices

# BGP ASN bounds
BGP_ASN_MIN = 1
BGP_ASN_MAX = 2**32 - 1

#
# Interface type groups
#

VIRTUAL_IFACE_TYPES = [
    InterfaceTypeChoices.TYPE_VIRTUAL,
    InterfaceTypeChoices.TYPE_LAG,
]

WIRELESS_IFACE_TYPES = [
    InterfaceTypeChoices.TYPE_80211A,
    InterfaceTypeChoices.TYPE_80211G,
    InterfaceTypeChoices.TYPE_80211N,
    InterfaceTypeChoices.TYPE_80211AC,
    InterfaceTypeChoices.TYPE_80211AD,
]

NONCONNECTABLE_IFACE_TYPES = VIRTUAL_IFACE_TYPES + WIRELESS_IFACE_TYPES

# Console/power/interface connection statuses
CONNECTION_STATUS_PLANNED = False
CONNECTION_STATUS_CONNECTED = True
CONNECTION_STATUS_CHOICES = [
    [CONNECTION_STATUS_PLANNED, 'Planned'],
    [CONNECTION_STATUS_CONNECTED, 'Connected'],
]

# Cable endpoint types
CABLE_TERMINATION_TYPES = [
    'consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport',
    'circuittermination', 'powerfeed',
]

CABLE_TERMINATION_TYPE_CHOICES = {
    # (API endpoint, human-friendly name)
    'consoleport': ('console-ports', 'Console port'),
    'consoleserverport': ('console-server-ports', 'Console server port'),
    'powerport': ('power-ports', 'Power port'),
    'poweroutlet': ('power-outlets', 'Power outlet'),
    'interface': ('interfaces', 'Interface'),
    'frontport': ('front-ports', 'Front panel port'),
    'rearport': ('rear-ports', 'Rear panel port'),
}

COMPATIBLE_TERMINATION_TYPES = {
    'consoleport': ['consoleserverport', 'frontport', 'rearport'],
    'consoleserverport': ['consoleport', 'frontport', 'rearport'],
    'powerport': ['poweroutlet', 'powerfeed'],
    'poweroutlet': ['powerport'],
    'interface': ['interface', 'circuittermination', 'frontport', 'rearport'],
    'frontport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
    'rearport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
    'circuittermination': ['interface', 'frontport', 'rearport'],
}


# Rack Elevation SVG Size
RACK_ELEVATION_UNIT_WIDTH_DEFAULT = 230
RACK_ELEVATION_UNIT_HEIGHT_DEFAULT = 20

@@ -94,16 +94,131 @@
 32 - 1%0A%0A
+%0A#%0A# Rack elevation rendering%0A#%0A%0ARACK_ELEVATION_UNIT_WIDTH_DEFAULT = 230%0ARACK_ELEVATION_UNIT_HEIGHT_DEFAULT = 20%0A%0A%0A
 #%0A# Inte
@@ -632,16 +632,89 @@
 _TYPES%0A%0A
+%0A#%0A# Cabling and connections%0A#%0A%0A# TODO: Replace with CableStatusChoices?%0A
 # Consol
@@ -1148,469 +1148,8 @@
 %0A%5D%0A%0A
-CABLE_TERMINATION_TYPE_CHOICES = %7B%0A    # (API endpoint, human-friendly name)%0A    'consoleport': ('console-ports', 'Console port'),%0A    'consoleserverport': ('console-server-ports', 'Console server port'),%0A    'powerport': ('power-ports', 'Power port'),%0A    'poweroutlet': ('power-outlets', 'Power outlet'),%0A    'interface': ('interfaces', 'Interface'),%0A    'frontport': ('front-ports', 'Front panel port'),%0A    'rearport': ('rear-ports', 'Rear panel port'),%0A%7D%0A%0A
 COMP
@@ -1770,114 +1770,6 @@
 '%5D,%0A
+
 %7D%0A
-%0A%0A# Rack Elevation SVG Size%0ARACK_ELEVATION_UNIT_WIDTH_DEFAULT = 230%0ARACK_ELEVATION_UNIT_HEIGHT_DEFAULT = 20%0A

Remove obsolete constant CABLE_TERMINATION_TYPE_CHOICES