{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://topologia.app/ia/diagrama.schema.json",
  "title": "topologia.app simple diagram",
  "description": "Simple format to create a network diagram for https://topologia.app. Devices and links are referenced by name; no coordinates are needed: the editor lays them out automatically. Open it with https://topologia.app/#json=<encodeURIComponent(JSON)> or https://topologia.app/#z=<deflate-raw + base64url>, or paste it in File > Import JSON.",
  "type": "object",
  "required": [
    "nodes"
  ],
  "properties": {
    "title": {
      "type": "string",
      "description": "Diagram title"
    },
    "nodes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Unique device name (hostname). Links refer to it."
          },
          "type": {
            "type": "string",
            "description": "Device type",
            "examples": [
              "router",
              "l3",
              "switch",
              "firewall",
              "server",
              "pc",
              "ap",
              "internet",
              "saas",
              "app",
              "api",
              "db",
              "lb",
              "vpn",
              "storage",
              "container",
              "generic"
            ]
          },
          "sub": {
            "type": "string",
            "description": "Subtitle: model, role or short description"
          },
          "notes": {
            "type": [
              "array",
              "string"
            ],
            "items": {
              "type": "string"
            },
            "description": "Extra lines shown on the device: IPs, loopbacks, VLANs, serials"
          },
          "zone": {
            "type": "string",
            "description": "Zone/group name (LAN, DMZ, Site A...). Devices with the same zone are drawn inside one box"
          },
          "ha": {
            "type": "string",
            "description": "Redundancy badge: Stack, M-LAG, VRRP/HSRP, HA activo/pasivo, HA activo/activo, Clúster or any text"
          },
          "layer": {
            "type": "integer",
            "minimum": 0,
            "description": "Optional row, 0 = top. If no device has a layer, rows are computed from the Internet/WAN edge down to the users"
          },
          "x": {
            "type": "number",
            "description": "Optional fixed position (px). Only if you really need exact placement"
          },
          "y": {
            "type": "number"
          }
        }
      }
    },
    "links": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "a",
          "b"
        ],
        "properties": {
          "a": {
            "type": "string",
            "description": "Name of device A"
          },
          "b": {
            "type": "string",
            "description": "Name of device B"
          },
          "pa": {
            "type": "string",
            "description": "Interface/port on A (e.g. Gi0/1, port1, Te1/0/1-2)"
          },
          "pb": {
            "type": "string",
            "description": "Interface/port on B"
          },
          "ip_a": {
            "type": "string",
            "description": "IP on A, e.g. 10.0.0.1/30"
          },
          "ip_b": {
            "type": "string",
            "description": "IP on B"
          },
          "label": {
            "type": "string",
            "description": "Label in the middle of the cable: network, VLAN, Po number"
          },
          "detail": {
            "type": "string",
            "description": "Extra detail (speed, circuit id)"
          },
          "kind": {
            "type": "string",
            "description": "Line style: port-channel (LACP/EtherChannel), dashed (backup/VPN), dotted. Empty = normal cable"
          }
        }
      }
    },
    "zones": {
      "type": "array",
      "description": "Optional: zone colors",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        }
      }
    }
  }
}
