{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.3/project/owners.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal ownership, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "Owners",
  "description": "project/owners.json (Part XVI, 2): the parties of a project, and the rules that say which of them own which paths, by globs (Part XVI, 3). The owners of a path are those of the last rule with a glob that matches it. A file of the standard's own folder, not a record.",
  "type": "object",
  "required": [
    "format",
    "parties",
    "rules"
  ],
  "properties": {
    "format": {
      "const": "openeik-owners/0.1"
    },
    "parties": {
      "description": "The project's parties: a firm, or a team. Their ids are unique (Part XVI, 2, rule 2).",
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "$ref": "#/$defs/party"
      }
    },
    "rules": {
      "description": "Which parties own which paths. Of the rules with a glob that matches a path, the last decides (Part XVI, 3, rule 3).",
      "type": "array",
      "minItems": 1,
      "maxItems": 200,
      "items": {
        "$ref": "#/$defs/rule"
      }
    }
  },
  "x-eik-closed": true,
  "$defs": {
    "id": {
      "description": "A party's id: a lower-case ASCII letter, then up to 31 lower-case letters, digits and hyphens.",
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{0,31}$"
    },
    "party": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "description": "The party's name as people know it; nothing is decided by it (Part XVI, 2, rule 3).",
          "type": "string",
          "minLength": 1
        },
        "discipline": {
          "description": "The discipline the party works in, where it has one; it gives the party no path (Part XVI, 2, rules 3 and 4).",
          "enum": [
            "architecture",
            "structure",
            "ventilation",
            "plumbing",
            "electrical",
            "sprinkler",
            "site",
            "setup"
          ]
        },
        "organisation": {
          "$ref": "#/$defs/organisation"
        }
      },
      "x-eik-closed": true
    },
    "organisation": {
      "description": "The organisation a party is: its name as people know it, and a domain of its own. A host links accounts to the party only as Part XVI, 7, rule 4 says (Part XVI, 2, rule 5).",
      "type": "object",
      "required": [
        "name",
        "domain"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "domain": {
          "description": "An Internet domain name, in lower case: two or more labels, each of 1 to 63 ASCII letters, digits and hyphens that neither begins nor ends with a hyphen.",
          "type": "string",
          "maxLength": 253,
          "pattern": "^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
        }
      },
      "x-eik-closed": true
    },
    "rule": {
      "type": "object",
      "required": [
        "paths",
        "owners"
      ],
      "properties": {
        "paths": {
          "description": "The paths the rule covers: globs over a version's leaf paths, `*` for any part of one segment and `**` for any number of whole segments (Part XVI, 3).",
          "type": "array",
          "minItems": 1,
          "maxItems": 50,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "owners": {
          "description": "The ids of the parties that own the paths, each a party of the file (Part XVI, 2, rule 2).",
          "type": "array",
          "minItems": 1,
          "maxItems": 100,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/id"
          }
        },
        "all": {
          "description": "True where a change to the paths needs every owner's approval; absent or false where it needs one's (Part XVI, 4, rule 2).",
          "type": "boolean"
        }
      },
      "x-eik-closed": true
    }
  }
}
