{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.2/project/circuit.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal electrical, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "Circuit",
  "description": "A circuit of an electrical installation, a group of a board, or the supply: project/circuits/<id>.json, one record per circuit (Part XIII, 3.1. A device names the circuit that feeds it (electrical.circuitId), and so does a board or a meter cabinet, for the circuit that feeds the board. A circuit whose boardId is null is the supply, from outside the model. Circuits of one board with the same rcd.designation share one residual-current device.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "pattern": "^[^/]+$"
    },
    "name": {
      "description": "What it serves, as a board schedule names it. Optional; never empty.",
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "designation": {
      "description": "Its designation on its board (G6, G13-15), or for the supply (Service). A board schedule sorts by board, then by designation in natural order.",
      "type": "string",
      "minLength": 1,
      "maxLength": 24
    },
    "boardId": {
      "description": "The board or meter cabinet it leaves: an electrical element whose type's kind is board or meterCabinet; null for the supply.",
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "x-eik-ref": "element"
    },
    "phases": {
      "description": "The line conductors it is connected to, each once: one, or all three. Absent until assigned.",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "L1",
          "L2",
          "L3"
        ]
      },
      "minItems": 1,
      "maxItems": 3,
      "uniqueItems": true
    },
    "voltage": {
      "description": "Its nominal voltage, V.",
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 100000
    },
    "protection": {
      "description": "What protects it: a breaker, a fuse or an RCBO, its characteristic and its rating, and the residual-current device in front of it.",
      "type": "object",
      "properties": {
        "device": {
          "type": "string",
          "enum": [
            "breaker",
            "fuse",
            "rcbo"
          ]
        },
        "characteristic": {
          "description": "A breaker's curve or a fuse's class (B, C, D, gG), as the national practice writes it.",
          "type": "string",
          "minLength": 1,
          "maxLength": 8,
          "x-eik-values": "national"
        },
        "rating": {
          "description": "A.",
          "type": "number",
          "exclusiveMinimum": 0,
          "maximum": 10000
        },
        "rcd": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "AC",
                "A",
                "F",
                "B"
              ]
            },
            "sensitivity": {
              "description": "mA.",
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 10000
            },
            "designation": {
              "description": "Its designation on the board (Q1): circuits of one board with the same designation share one device.",
              "type": "string",
              "minLength": 1,
              "maxLength": 24
            }
          },
          "required": [
            "type",
            "sensitivity"
          ],
          "x-eik-closed": true
        }
      },
      "required": [
        "device",
        "rating"
      ],
      "x-eik-closed": true
    },
    "cable": {
      "description": "The cable of its legs, but where a device names its own (electrical.cable).",
      "$ref": "#/$defs/cable"
    },
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "classifications": {
      "$ref": "../classifications/classifications.schema.json"
    }
  },
  "required": [
    "id",
    "designation",
    "boardId",
    "revision"
  ],
  "x-eik-closed": true,
  "$defs": {
    "cable": {
      "description": "A cable as a drawing tags it: \"3G1,5\" is 3 conductors of 1.5 mm2, one of them the protective earth; \"4x25/16\" is 4 conductors of 25 mm2 and a protective conductor of 16 mm2.",
      "type": "object",
      "properties": {
        "type": {
          "description": "Its type designation, as the national practice writes it.",
          "type": "string",
          "minLength": 1,
          "maxLength": 40,
          "x-eik-values": "national"
        },
        "conductors": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "area": {
          "description": "Each conductor's cross-section, mm2.",
          "type": "number",
          "exclusiveMinimum": 0,
          "maximum": 10000
        },
        "earth": {
          "description": "Whether one of the conductors is the protective earth.",
          "type": "boolean"
        },
        "protectiveArea": {
          "description": "The protective conductor's cross-section where it is smaller, mm2.",
          "type": "number",
          "exclusiveMinimum": 0,
          "maximum": 10000
        }
      },
      "required": [
        "type",
        "conductors",
        "area",
        "earth"
      ],
      "x-eik-closed": true
    }
  }
}
