{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "$id": "https://mlexplorer.com/schemas/edition-1.0.0.json",
  "title": "MLExplorer public edition manifest",
  "properties": {
    "schema_version": {
      "const": "1.0.0"
    },
    "id": {
      "type": "string"
    },
    "kind": {
      "enum": [
        "paper",
        "technical_report",
        "experiment",
        "method",
        "clv",
        "distinction"
      ]
    },
    "title": {
      "type": "string"
    },
    "path": {
      "type": "string",
      "pattern": "^/"
    },
    "relations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "target",
          "version",
          "edition_url"
        ],
        "properties": {
          "type": {
            "enum": [
              "supports",
              "contradicts",
              "extends",
              "corrects",
              "tests",
              "exhibits",
              "implements",
              "companion",
              "relates_to",
              "documented_in",
              "observed_in",
              "distinguished_by"
            ]
          },
          "target": {
            "type": "string",
            "pattern": "^/"
          },
          "version": {
            "type": [
              "string",
              "null"
            ]
          },
          "edition_url": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "record_key": {
      "type": "string"
    },
    "edition": {
      "type": "string"
    },
    "summary": {
      "type": "string"
    },
    "authors": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    },
    "manuscript_date": {
      "type": "string",
      "format": "date"
    },
    "manuscript_edition": {
      "type": [
        "string",
        "null"
      ]
    },
    "published_at": {
      "type": "string",
      "format": "date"
    },
    "visibility": {
      "const": "public"
    },
    "publication_stage": {
      "enum": [
        "working",
        "preprint",
        "published"
      ]
    },
    "source_revision": {
      "type": "string",
      "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
    },
    "identifiers": {
      "type": "object",
      "properties": {
        "doi": {
          "type": [
            "string",
            "null"
          ]
        },
        "arxiv": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "label",
          "path",
          "sha256"
        ],
        "properties": {
          "kind": {
            "enum": [
              "manuscript",
              "supplement",
              "evidence",
              "supporting"
            ]
          },
          "label": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      }
    },
    "evidence": {
      "type": "object",
      "required": [
        "limits",
        "independent_replication"
      ],
      "properties": {
        "limits": {
          "type": "string"
        },
        "state": {
          "enum": [
            "current",
            "stale",
            "unknown",
            null
          ]
        },
        "independent_replication": {
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    },
    "details": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "kind",
            "research_question",
            "findings"
          ],
          "properties": {
            "kind": {
              "const": "publication"
            },
            "research_question": {
              "type": [
                "string",
                "null"
              ]
            },
            "findings": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "label",
                  "result",
                  "scope"
                ],
                "properties": {
                  "label": {
                    "type": "string"
                  },
                  "result": {
                    "type": "string"
                  },
                  "scope": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind",
            "setup",
            "reproducibility"
          ],
          "properties": {
            "kind": {
              "const": "experiment"
            },
            "setup": {
              "type": "string"
            },
            "reproducibility": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind",
            "protocol"
          ],
          "properties": {
            "kind": {
              "const": "method"
            },
            "protocol": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind",
            "boundary",
            "contrasted_with"
          ],
          "properties": {
            "kind": {
              "const": "distinction"
            },
            "boundary": {
              "type": "string"
            },
            "contrasted_with": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind",
            "affected_mechanism",
            "observed_conditions",
            "applicability",
            "classification",
            "diagnostic_procedure",
            "distinctions",
            "observations",
            "diagnostic_methods",
            "verified_repairs",
            "compatibility"
          ],
          "properties": {
            "kind": {
              "const": "clv"
            },
            "affected_mechanism": {
              "type": "string"
            },
            "observed_conditions": {
              "type": "string"
            },
            "applicability": {
              "type": "string"
            },
            "classification": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "diagnostic_procedure": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "distinctions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "observations": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "diagnostic_methods": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "target",
                  "edition"
                ],
                "properties": {
                  "target": {
                    "type": "string"
                  },
                  "edition": {
                    "type": "string"
                  }
                }
              }
            },
            "verified_repairs": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "target",
                  "edition"
                ],
                "properties": {
                  "target": {
                    "type": "string"
                  },
                  "edition": {
                    "type": "string"
                  }
                }
              }
            },
            "compatibility": {
              "type": "object",
              "required": [
                "adapteros"
              ],
              "properties": {
                "adapteros": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "required": [
                    "contract",
                    "violation_codes",
                    "mapping_status"
                  ],
                  "properties": {
                    "contract": {
                      "type": "string"
                    },
                    "violation_codes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mapping_status": {
                      "enum": [
                        "proposed",
                        "verified"
                      ]
                    },
                    "verification": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  },
  "required": [
    "schema_version",
    "id",
    "kind",
    "title",
    "path",
    "relations",
    "record_key",
    "edition",
    "summary",
    "authors",
    "manuscript_date",
    "published_at",
    "visibility",
    "publication_stage",
    "source_revision",
    "identifiers",
    "artifacts",
    "evidence",
    "details"
  ]
}
