{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.7/drawings/drawing-set.schema.json",
  "$comment": "OpenEik 0.7: folded by tools/fold-schemas-0.7.mjs from the proposal drawingSets, which 0.7 makes a rule (open questions, 180). Written by hand, not generated.",
  "title": "Drawing set",
  "description": "A named list of a model's views and sheets that serves to browse, print, publish and share them (Part XIV, 2.5, rule 3): either a rule over facts every reader knows, or members picked by hand, in order, never both (rule 5). What it holds is derived on reading, never stored (rule 11).",
  "type": "object",
  "properties": {
    "id": {
      "description": "Its id (Part I, 6): the name of its file, drawings/<owner>/sets/<segment(id)>.json.",
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "pattern": "^[^/]+$"
    },
    "name": {
      "description": "What people call it: Permit, Construction – K, Site meeting 4 December.",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "revision": {
      "description": "The record's revision (Part I, 8), a precondition token.",
      "type": "integer",
      "minimum": 0
    },
    "owner": {
      "$ref": "../ownership/owner.schema.json",
      "description": "Its owner, one of the eight disciplines; absent, setup (Part XIV, 2.5, rule 4; Part III, 4.4, rule 5). Its file is in its owner's folder."
    },
    "rule": {
      "$ref": "#/$defs/rule"
    },
    "members": {
      "description": "The drawings it holds, picked, in order (Part XIV, 2.5, rule 9): each a view or a sheet by its id, each once. A member that names no drawing of the model is kept in its place and listed as missing (rule 10).",
      "type": "array",
      "maxItems": 10000,
      "items": {
        "$ref": "#/$defs/member"
      }
    },
    "purpose": {
      "description": "The purpose of the drawing profile it is meant to be issued for (Part XIV, 2.5, rule 14; 4.1): a default an issuer offers, never the issue's own purpose.",
      "type": "object",
      "properties": {
        "profile": {
          "$ref": "defs.schema.json#/$defs/profileId"
        },
        "code": {
          "$ref": "defs.schema.json#/$defs/code"
        }
      },
      "required": [
        "profile",
        "code"
      ],
      "x-eik-closed": true
    }
  },
  "required": [
    "id",
    "name",
    "revision"
  ],
  "oneOf": [
    {
      "required": [
        "rule"
      ],
      "not": {
        "required": [
          "members"
        ]
      }
    },
    {
      "required": [
        "members"
      ],
      "not": {
        "required": [
          "rule"
        ]
      }
    }
  ],
  "x-eik-closed": true,
  "$defs": {
    "rule": {
      "description": "A rule over facts every reader knows (Part XIV, 2.5, rules 6 and 7): a drawing matches it when it matches every field the rule gives, and a field when one of its values matches. A rule that gives no field matches every view and sheet. A field this schema does not name is refused, not kept: a reader that left one out would hold more drawings than the rule.",
      "type": "object",
      "properties": {
        "kind": {
          "description": "A view's kind, or sheet for a sheet.",
          "$ref": "#/$defs/values",
          "items": {
            "enum": [
              "sheet",
              "plan",
              "section",
              "elevation",
              "3d",
              "drafting"
            ]
          }
        },
        "discipline": {
          "description": "The drawing's owner (Part III, 4.4, rule 5): a view's owner, else setup; a sheet's, its discipline code's.",
          "$ref": "#/$defs/values",
          "items": {
            "$ref": "../ownership/owner.schema.json"
          }
        },
        "level": {
          "description": "A level by its id: a view's levelId; for a sheet, the levels of the views it places.",
          "$ref": "#/$defs/values",
          "items": {
            "type": "string",
            "minLength": 1,
            "x-eik-ref": "level"
          }
        },
        "area": {
          "description": "A scope box by its id: a view's scopeBoxId; for a sheet, the scope boxes of the views it places.",
          "$ref": "#/$defs/values",
          "items": {
            "type": "string",
            "minLength": 1,
            "x-eik-ref": "scopeBox"
          }
        },
        "tag": {
          "description": "A tag of the drawing's (rule 1).",
          "$ref": "#/$defs/values",
          "items": {
            "$ref": "../drawingSets/tags.schema.json#/items"
          }
        },
        "number": {
          "description": "A glob over a sheet's number: * any run of characters, none included, ? any one character, every other character itself, matched against the whole number. A view has no number.",
          "$ref": "#/$defs/values",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        }
      },
      "additionalProperties": false
    },
    "values": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "uniqueItems": true
    },
    "member": {
      "description": "A drawing by its id: {view} or {sheet}, one of the two.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "minLength": 1,
              "x-eik-ref": "view"
            }
          },
          "required": [
            "view"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "sheet": {
              "type": "string",
              "minLength": 1,
              "x-eik-ref": "sheet"
            }
          },
          "required": [
            "sheet"
          ],
          "additionalProperties": false
        }
      ]
    }
  }
}
