{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cloud.google.com/schemas/distributedcloud/network.json",
  "title": "Google Distributed Cloud Edge Network",
  "description": "Schema for a Distributed Cloud edge network resource used to define network configurations in edge deployments.",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The resource name of the network"
    },
    "createTime": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the network was created"
    },
    "updateTime": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the network was last updated"
    },
    "labels": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Labels applied to the network"
    },
    "description": {
      "type": "string",
      "description": "User-provided description of the network"
    },
    "mtu": {
      "type": "integer",
      "description": "Maximum transmission unit in bytes",
      "minimum": 1280,
      "maximum": 9000
    },
    "subnets": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Subnet"
      },
      "description": "Subnets associated with this network"
    },
    "routers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Router"
      },
      "description": "Routers associated with this network"
    }
  },
  "$defs": {
    "Subnet": {
      "type": "object",
      "description": "A subnet within an edge network",
      "properties": {
        "name": {
          "type": "string",
          "description": "Resource name of the subnet"
        },
        "network": {
          "type": "string",
          "description": "The parent network resource name"
        },
        "ipv4Cidr": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}$"
          },
          "description": "IPv4 CIDR ranges for the subnet"
        },
        "ipv6Cidr": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "IPv6 CIDR ranges for the subnet"
        },
        "vlanId": {
          "type": "integer",
          "description": "VLAN ID for the subnet",
          "minimum": 1,
          "maximum": 4094
        },
        "description": {
          "type": "string",
          "description": "User-provided description"
        }
      }
    },
    "Router": {
      "type": "object",
      "description": "A router within an edge network",
      "properties": {
        "name": {
          "type": "string",
          "description": "Resource name of the router"
        },
        "network": {
          "type": "string",
          "description": "The parent network resource name"
        },
        "bgpPeers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BgpPeer"
          },
          "description": "BGP peer configurations"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "BgpPeer": {
      "type": "object",
      "description": "A BGP peer configuration for a router",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the BGP peer"
        },
        "peerIpAddress": {
          "type": "string",
          "description": "IP address of the BGP peer"
        },
        "peerAsn": {
          "type": "integer",
          "description": "ASN of the BGP peer",
          "minimum": 1
        },
        "localAsn": {
          "type": "integer",
          "description": "Local ASN for this peer session",
          "minimum": 1
        }
      }
    }
  }
}
