{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.2/drawings/sheet.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal drawings, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "Sheet",
  "description": "A sheet, drawings/sheets/<id>.json (Part XIV, 2: a paper, the views placed on it and its title-block fields. Its number is the drawing's, stable across revisions, and names the folder of its issued drawing. The values that change with each revision (the date of issue, the revision code, the status, the revision table) come from the revision record and the register, never from the sheet.",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "defs.schema.json#/$defs/id"
    },
    "number": {
      "$ref": "defs.schema.json#/$defs/number"
    },
    "name": {
      "description": "The title.",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "discipline": {
      "description": "The sheet's discipline code (XIV.2.1): one to four capital letters, the letters a drawing number of its discipline begins with, A, K, V, VS, E or a project's own. Where it gives none, the letters its number begins with are its code. Its folder in the owners' layout is the code's discipline (Part III, 4.4, rule 5).",
      "type": "string",
      "pattern": "^[A-ZÅÄÖ]{1,4}$"
    },
    "revision": {
      "description": "The record's revision (Part I, 8), a precondition token; not the drawing's revision code.",
      "type": "integer",
      "minimum": 0
    },
    "width": {
      "description": "The paper's width, mm.",
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 10000
    },
    "height": {
      "description": "The paper's height, mm.",
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 10000
    },
    "viewports": {
      "description": "The views placed on the sheet, in the order an issued drawing draws them (XIV.6.7).",
      "type": "array",
      "maxItems": 200,
      "items": {
        "$ref": "#/$defs/viewport"
      }
    },
    "fields": {
      "$ref": "#/$defs/fields"
    },
    "titleBlockId": {
      "description": "The application's title block (Part II, 9.1) whose graphics the sheet uses; none for a blank sheet.",
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "x-eik-ref": "titleBlock"
    },
    "inRegister": {
      "description": "false leaves the sheet out of the register a host lists; absent, it is listed.",
      "type": "boolean"
    },
    "classifications": {
      "$ref": "../classifications/classifications.schema.json"
    }
  },
  "required": [
    "id",
    "number",
    "name",
    "revision",
    "width",
    "height",
    "viewports"
  ],
  "x-eik-closed": true,
  "$defs": {
    "viewport": {
      "description": "A view placed on the sheet: the top-left corner of its box on the paper, in mm, y down; its size is the view's crop at the view's scale (XIV.2.2).",
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique in the sheet (XIV.2.4, rule 3).",
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "viewId": {
          "description": "The view placed.",
          "type": "string",
          "minLength": 1,
          "x-eik-ref": "view"
        },
        "x": {
          "type": "number",
          "minimum": 0
        },
        "y": {
          "type": "number",
          "minimum": 0
        },
        "detailNumber": {
          "description": "The number or the name its title and marks show: 1 to 40 characters, and short (XIV.2.4, rule 4).",
          "type": "string",
          "minLength": 1,
          "maxLength": 40
        },
        "rotation": {
          "description": "Degrees, about the box's centre.",
          "type": "number",
          "minimum": -360,
          "maximum": 360
        },
        "title": {
          "description": "The viewport's title: whether it shows, its lines, its width and its offset in paper mm.",
          "type": "object",
          "properties": {
            "show": {
              "type": "boolean"
            },
            "lines": {
              "type": "array",
              "minItems": 1,
              "maxItems": 4,
              "items": {
                "type": "string",
                "maxLength": 160
              }
            },
            "width": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 300
            },
            "offset": {
              "$ref": "defs.schema.json#/$defs/point"
            }
          },
          "x-eik-closed": true
        }
      },
      "required": [
        "id",
        "viewId",
        "x",
        "y",
        "detailNumber"
      ],
      "x-eik-closed": true
    },
    "field": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "fields": {
      "description": "Title-block field values (XIV.2.3): ISO 7200's legal owner, creator, document type, approval person and sheet number (absent meaning 1), and its supplementary fields. fields.approver is what is printed, not proof of approval, which the sign-offs give. Extension members (Part I, 11.2) are an application's own fields.",
      "type": "object",
      "properties": {
        "legalOwner": {
          "$ref": "#/$defs/field"
        },
        "creator": {
          "$ref": "#/$defs/field"
        },
        "documentType": {
          "$ref": "#/$defs/field"
        },
        "approver": {
          "$ref": "#/$defs/field"
        },
        "sheetNumber": {
          "$ref": "#/$defs/field"
        },
        "supplementaryTitle": {
          "$ref": "#/$defs/field"
        },
        "responsibleDepartment": {
          "$ref": "#/$defs/field"
        },
        "technicalReference": {
          "$ref": "#/$defs/field"
        },
        "language": {
          "$ref": "#/$defs/field"
        }
      },
      "x-eik-closed": true
    }
  }
}
