{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "urn:exploder-kit:scene:1",
 "title": "The scene as components",
 "description": "scene.json (studio/scene.py): every component of the scene as an asset with its category, location, pages, dated sources, identity and export.",
 "type": "object",
 "required": [
  "project",
  "components",
  "counts"
 ],
 "properties": {
  "project": {
   "type": [
    "string",
    "null"
   ]
  },
  "counts": {
   "type": "object"
  },
  "components": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "id",
     "kind",
     "category",
     "location",
     "pages",
     "sources",
     "export"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "kind": {
      "type": "string"
     },
     "category": {
      "type": [
       "string",
       "null"
      ]
     },
     "location": {
      "type": "object"
     },
     "pages": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "doc",
        "page",
        "how"
       ]
      }
     },
     "sources": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "id",
        "date"
       ]
      }
     },
     "export": {
      "type": "object",
      "required": [
       "gltf",
       "image"
      ]
     },
     "identity": {
      "type": "object",
      "required": [
       "maker",
       "model",
       "type",
       "in_service",
       "serial",
       "maker_candidates"
      ],
      "properties": {
       "maker": {
        "oneOf": [
         {
          "const": "not yet captured"
         },
         {
          "type": "object",
          "required": [
           "value",
           "source",
           "date"
          ],
          "properties": {
           "value": {},
           "id": {
            "type": "string"
           },
           "source": {
            "type": [
             "string",
             "null"
            ]
           },
           "date": {
            "type": "string"
           },
           "basis": {
            "type": "string"
           },
           "from": {
            "type": "string"
           },
           "note": {
            "type": "string"
           }
          }
         },
         {
          "type": "object",
          "required": [
           "state",
           "why",
           "source"
          ],
          "additionalProperties": false,
          "properties": {
           "state": {
            "const": "not_known"
           },
           "why": {
            "type": "string",
            "minLength": 1
           },
           "would_answer": {
            "type": "string"
           },
           "source": {
            "type": "string"
           }
          }
         }
        ]
       },
       "model": {
        "oneOf": [
         {
          "const": "not yet captured"
         },
         {
          "type": "object",
          "required": [
           "value",
           "source",
           "date"
          ],
          "properties": {
           "value": {},
           "id": {
            "type": "string"
           },
           "source": {
            "type": [
             "string",
             "null"
            ]
           },
           "date": {
            "type": "string"
           },
           "basis": {
            "type": "string"
           },
           "from": {
            "type": "string"
           },
           "note": {
            "type": "string"
           }
          }
         },
         {
          "type": "object",
          "required": [
           "state",
           "why",
           "source"
          ],
          "additionalProperties": false,
          "properties": {
           "state": {
            "const": "not_known"
           },
           "why": {
            "type": "string",
            "minLength": 1
           },
           "would_answer": {
            "type": "string"
           },
           "source": {
            "type": "string"
           }
          }
         }
        ]
       },
       "in_service": {
        "oneOf": [
         {
          "const": "not yet captured"
         },
         {
          "type": "object",
          "required": [
           "value",
           "source",
           "date"
          ],
          "properties": {
           "value": {},
           "id": {
            "type": "string"
           },
           "source": {
            "type": [
             "string",
             "null"
            ]
           },
           "date": {
            "type": "string"
           },
           "basis": {
            "type": "string"
           },
           "from": {
            "type": "string"
           },
           "note": {
            "type": "string"
           }
          }
         },
         {
          "type": "object",
          "required": [
           "state",
           "why",
           "source"
          ],
          "additionalProperties": false,
          "properties": {
           "state": {
            "const": "not_known"
           },
           "why": {
            "type": "string",
            "minLength": 1
           },
           "would_answer": {
            "type": "string"
           },
           "source": {
            "type": "string"
           }
          }
         }
        ]
       },
       "serial": {
        "oneOf": [
         {
          "const": "not yet captured"
         },
         {
          "type": "object",
          "required": [
           "value",
           "source",
           "date"
          ],
          "properties": {
           "value": {},
           "id": {
            "type": "string"
           },
           "source": {
            "type": [
             "string",
             "null"
            ]
           },
           "date": {
            "type": "string"
           },
           "basis": {
            "type": "string"
           },
           "from": {
            "type": "string"
           },
           "note": {
            "type": "string"
           }
          }
         },
         {
          "type": "object",
          "required": [
           "state",
           "why",
           "source"
          ],
          "additionalProperties": false,
          "properties": {
           "state": {
            "const": "not_known"
           },
           "why": {
            "type": "string",
            "minLength": 1
           },
           "would_answer": {
            "type": "string"
           },
           "source": {
            "type": "string"
           }
          }
         }
        ]
       },
       "type": {
        "type": [
         "string",
         "null"
        ]
       },
       "maker_candidates": {
        "type": "array"
       },
       "catalogue": {
        "type": "object",
        "required": [
         "item",
         "site",
         "installed_base_version",
         "catalogue_version",
         "snapshot"
        ],
        "description": "The installed item this identity came from, and the snapshot it was read from."
       }
      },
      "description": "What is known of the component's make: from the record (scene.py), or from a product-catalogue@1 installed base by scene_component (catalogue.py). A value carries its source, date and basis; a value nobody has found is 'not yet captured' or the catalogue's not_known with why and what would answer it."
     }
    }
   }
  }
 }
}