{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.6/project/work-schedules.schema.json",
  "$comment": "OpenEik 0.6: folded by tools/fold-schemas-0.6.mjs from the proposal workSchedules, which 0.6 makes a rule (open questions, 153). Written by hand, not generated.",
  "title": "project/work-schedules.json",
  "description": "A project's work schedules (Part XXII, 5: its calendars, each the days of the week worked and the days not worked; and its schedules, each a start and its tasks, each task its duration in working days, the tasks it follows and how, and the elements it builds or takes away. A task's dates, its floats and the critical path are derived (Part XXII, 5.6); its progress, as reported to a status date, is stored, and its forecast derived (Part XXII, 5.8 and 5.9).",
  "type": "object",
  "properties": {
    "calendars": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "$ref": "#/$defs/calendar"
      },
      "description": "The calendars the schedules count working days by (Part XXII, 5.2)."
    },
    "workSchedules": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "$ref": "#/$defs/schedule"
      },
      "description": "The work schedules, in the order people read them."
    }
  },
  "x-eik-closed": true,
  "$defs": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "pattern": "^[^/\\s]+$",
      "description": "An id: a calendar's unique among the calendars, a schedule's among the schedules, a task's among its schedule's tasks (Part XXII, 5.1, rule 3)."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "A name, for people: nothing is decided by it."
    },
    "date": {
      "type": "string",
      "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$",
      "description": "A day, YYYY-MM-DD, of the Gregorian calendar, in no time zone: the site's day (Part XXII, 5.2, rule 1)."
    },
    "calendar": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "workdays": {
          "type": "array",
          "minItems": 1,
          "maxItems": 7,
          "uniqueItems": true,
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          },
          "description": "The days of the week worked, by their numbers of ISO 8601: 1 Monday to 7 Sunday."
        },
        "holidays": {
          "type": "array",
          "minItems": 1,
          "maxItems": 2000,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/date"
          },
          "description": "The days not worked that a workday would be: public holidays, a builders' holiday."
        }
      },
      "required": [
        "id",
        "name",
        "workdays"
      ],
      "x-eik-closed": true
    },
    "schedule": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "kind": {
          "enum": [
            "planned",
            "baseline"
          ],
          "description": "What the schedule is (Part XXII, 5.3, rule 2): the plan worked to, or a plan kept to compare it with, as IFC's IfcWorkScheduleTypeEnum names them."
        },
        "start": {
          "$ref": "#/$defs/date",
          "description": "The day work starts: its first working day on or after it is the schedule's first."
        },
        "calendar": {
          "$ref": "#/$defs/id",
          "description": "The calendar of the file it counts working days by; absent, every day is a working day."
        },
        "statusDate": {
          "$ref": "#/$defs/date",
          "description": "The status date, the data date: the last day the schedule's progress is reported for, to its end (Part XXII, 5.8, rule 1). Given where a task gives progress."
        },
        "tasks": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10000,
          "items": {
            "$ref": "#/$defs/task"
          },
          "description": "Its tasks, in the order people read them (Part XXII, 5.4); absent while it has none."
        },
        "classifications": {
          "$ref": "../classifications/classifications.schema.json"
        }
      },
      "required": [
        "id",
        "name",
        "kind",
        "start"
      ],
      "x-eik-closed": true
    },
    "task": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "parent": {
          "$ref": "#/$defs/id",
          "description": "The task of its schedule it is a part of: a task others name so is a summary task, its dates its parts' (Part XXII, 5.4, rule 2)."
        },
        "kind": {
          "enum": [
            "construction",
            "installation",
            "demolition",
            "removal",
            "dismantle",
            "disposal",
            "logistic",
            "move",
            "attendance",
            "maintenance",
            "operation",
            "renovation"
          ],
          "description": "What is done, as IFC's IfcTaskTypeEnum names it: whether its elements are built (its outputs) or taken away (its inputs) is read from it (Part XXII, 5.4, rule 4)."
        },
        "duration": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100000,
          "description": "How many working days it takes: 0 is a milestone."
        },
        "after": {
          "type": "array",
          "minItems": 1,
          "maxItems": 100,
          "items": {
            "$ref": "#/$defs/sequence"
          },
          "description": "The tasks it follows, and how (Part XXII, 5.5)."
        },
        "notBefore": {
          "$ref": "#/$defs/date",
          "description": "It starts on this day or later: on its first working day on or after it at the earliest."
        },
        "elements": {
          "$ref": "../costSchedules/selection.schema.json",
          "description": "The elements it builds, installs or takes away (Part XXII, 2)."
        },
        "progressBy": {
          "enum": [
            "count",
            "area",
            "barCount",
            "castVolume",
            "cutVolume",
            "fillVolume",
            "grossArea",
            "grossExteriorArea",
            "grossInteriorArea",
            "grossPerimeter",
            "grossSideArea",
            "grossVolume",
            "grossWallArea",
            "hipLength",
            "length",
            "netArea",
            "netCeilingArea",
            "netExteriorArea",
            "netFloorArea",
            "netInteriorArea",
            "netMass",
            "netPerimeter",
            "netSideArea",
            "netVolume",
            "netWallArea",
            "openingArea",
            "perimeter",
            "pieceCount",
            "postCount",
            "projectedArea",
            "ridgeLength",
            "riserCount",
            "treadCount",
            "zoneVolume"
          ],
          "description": "What its elements' share built is weighed by (Part XXII, 5.8, rule 4): a quantity Part XXI sums, by its name, or count, each element one; absent, count."
        },
        "actualStart": {
          "$ref": "#/$defs/date",
          "description": "The day work on it started (Part XXII, 5.8, rule 2)."
        },
        "actualFinish": {
          "$ref": "#/$defs/date",
          "description": "The day it was finished, to its end: it is complete (Part XXII, 5.8, rule 2)."
        },
        "built": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 5000,
          "propertyNames": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "additionalProperties": {
            "$ref": "#/$defs/date"
          },
          "description": "Its elements built, or taken away, each by its id and the day it was (Part XXII, 5.8, rule 3): its progress where it names elements."
        },
        "percent": {
          "type": "number",
          "minimum": 0,
          "maximum": 100,
          "description": "Its share complete, in per cent, as reported (Part XXII, 5.8, rule 3): its progress where it names no elements."
        },
        "classifications": {
          "$ref": "../classifications/classifications.schema.json"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "x-eik-closed": true
    },
    "sequence": {
      "type": "object",
      "properties": {
        "task": {
          "$ref": "#/$defs/id",
          "description": "The task of its schedule it follows."
        },
        "type": {
          "enum": [
            "finishToStart",
            "startToStart",
            "finishToFinish",
            "startToFinish"
          ],
          "description": "How it follows: absent, finishToStart."
        },
        "lag": {
          "type": "integer",
          "minimum": -10000,
          "maximum": 10000,
          "description": "Working days between, after the other's start or finish; less than 0 a lead. Absent, 0."
        }
      },
      "required": [
        "task"
      ],
      "x-eik-closed": true
    }
  },
  "minProperties": 1
}
