{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.5/pieces/along.schema.json",
  "$comment": "OpenEik 0.5: folded by tools/fold-schemas-0.5.mjs from the proposal pieces, which 0.5 makes a rule (open questions, 124). Written by hand, not generated.",
  "title": "A piece rule along a line",
  "description": "A slab edge type's piece rule (Part XX, 2.1): the straight's length, the corner pieces, where a run is cut, the least cut, whether its pieces may be cut, what they do in an opening and its fall, the clearance round a hole, its marks, and its maker's data.",
  "type": "object",
  "properties": {
    "length": {
      "type": "number",
      "description": "A straight piece's length, mm.",
      "minimum": 100,
      "maximum": 10000
    },
    "corner": {
      "type": "object",
      "description": "Its outer corner piece (Part XX, 4.2, rules 2 and 3).",
      "properties": {
        "legs": {
          "type": "array",
          "description": "Its two legs [a, b], mm, along the section's outer face: a along the edge that ends at the corner, b along the edge that starts there (Part XX, 4.2, rule 2).",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "number",
            "minimum": 50,
            "maximum": 10000
          }
        },
        "angle": {
          "type": "number",
          "description": "The angle the outline turns through at a corner the piece fits, degrees; 90 where it gives none (Part XX, 4.2, rule 1).",
          "exclusiveMinimum": 0,
          "exclusiveMaximum": 180
        },
        "pair": {
          "type": "boolean",
          "description": "True where the corner is two pieces, each of the element its leg lies on."
        }
      },
      "required": [
        "legs"
      ],
      "x-eik-closed": true
    },
    "innerCorner": {
      "description": "How an inner corner is made: \"straights\", the default, mitred straights, or an inner corner piece of its own (Part XX, 4.2, rule 4).",
      "oneOf": [
        {
          "const": "straights"
        },
        {
          "type": "object",
          "properties": {
            "legs": {
              "type": "array",
              "description": "Its two legs [a, b], mm, along the section's outer face: a along the edge that ends at the corner, b along the edge that starts there (Part XX, 4.2, rule 2).",
              "minItems": 2,
              "maxItems": 2,
              "items": {
                "type": "number",
                "minimum": 50,
                "maximum": 10000
              }
            },
            "angle": {
              "type": "number",
              "description": "The angle the outline turns through at a corner the piece fits, degrees; 90 where it gives none (Part XX, 4.2, rule 1).",
              "exclusiveMinimum": 0,
              "exclusiveMaximum": 180
            }
          },
          "required": [
            "legs"
          ],
          "x-eik-closed": true
        }
      ]
    },
    "cut": {
      "type": "string",
      "enum": [
        "end",
        "start",
        "middle"
      ],
      "description": "Where a run's closing piece is cut (Part XX, 4.3, rule 3); \"end\" where it gives none."
    },
    "minCut": {
      "type": "number",
      "description": "The least length of a cut piece, mm, at most half of length (Part XX, 2.1, rule 3; 4.3, rule 4).",
      "minimum": 0,
      "maximum": 5000
    },
    "cuttable": {
      "type": "boolean",
      "description": "False where its pieces may not be cut (Part XX, 4.3, rule 7)."
    },
    "opening": {
      "type": "object",
      "description": "What its pieces do in an opening, a notch, and its notches' fall (Part XX, 4.5).",
      "properties": {
        "pieces": {
          "type": "string",
          "enum": [
            "none",
            "through"
          ],
          "description": "\"none\", the default: no piece in the notch; \"through\": the pieces run through it, cut level at its depth."
        },
        "threshold": {
          "type": "object",
          "description": "With \"none\", the threshold angle along each notch (Part XX, 4.5, rule 4).",
          "properties": {
            "width": {
              "type": "number",
              "description": "Its leg on the top, into the host, mm.",
              "exclusiveMinimum": 0,
              "maximum": 500
            },
            "depth": {
              "type": "number",
              "description": "Its leg down the outer face, mm.",
              "exclusiveMinimum": 0,
              "maximum": 500
            },
            "thickness": {
              "type": "number",
              "description": "Its thickness, mm.",
              "exclusiveMinimum": 0,
              "maximum": 50
            },
            "material": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "stock": {
              "type": "number",
              "description": "The length it is bought in, mm.",
              "minimum": 100,
              "maximum": 20000
            },
            "materialId": {
              "$ref": "../materialId/material-id.schema.json"
            }
          },
          "required": [
            "width",
            "depth",
            "thickness"
          ],
          "x-eik-closed": true
        },
        "stopEnds": {
          "type": "object",
          "description": "With \"through\", a stop-end at each end of each notch (Part XX, 4.5, rule 5).",
          "properties": {
            "thickness": {
              "type": "number",
              "description": "Its thickness, mm.",
              "exclusiveMinimum": 0,
              "maximum": 100
            },
            "material": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "materialId": {
              "$ref": "../materialId/material-id.schema.json"
            }
          },
          "required": [
            "thickness"
          ],
          "x-eik-closed": true
        },
        "fall": {
          "type": "number",
          "description": "Its notches' fall outward, ‰, where a notch gives none of its own; 20 where it gives none (Part XX, 4.5, rule 8).",
          "minimum": 0,
          "maximum": 100
        }
      },
      "x-eik-closed": true,
      "if": {
        "properties": {
          "pieces": {
            "const": "through"
          }
        },
        "required": [
          "pieces"
        ]
      },
      "then": {
        "not": {
          "required": [
            "threshold"
          ]
        }
      },
      "else": {
        "not": {
          "required": [
            "stopEnds"
          ]
        }
      }
    },
    "clearance": {
      "type": "number",
      "description": "The clearance all round a hole for a pipe or a duct, mm; 10 where it gives none (Part XX, 4.7, rule 1; 5.7).",
      "minimum": 0,
      "maximum": 100
    },
    "mark": {
      "type": "string",
      "description": "The start of its pieces' marks (Part XX, 6, rule 5).",
      "minLength": 1,
      "maxLength": 20,
      "pattern": "^\\S+$"
    },
    "maker": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "description": "Its maker's name, data (Part XX, 11)."
    },
    "articles": {
      "type": "object",
      "description": "Its article numbers by kind of piece, data (Part XX, 11).",
      "properties": {
        "straight": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "corner": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "cornerBefore": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "cornerAfter": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "innerCorner": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        }
      },
      "x-eik-closed": true
    }
  },
  "required": [
    "length"
  ],
  "x-eik-closed": true
}
