{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://famulus.lettre.ai/expertise/schema/famulus-expertise-1.schema.json",
 "title": "famulus-expertise/1: the preamble of an issue of Famulus Expertise",
 "type": "object",
 "required": [
  "schema",
  "subject",
  "claims",
  "agent",
  "review",
  "identity",
  "responsibility",
  "evidence",
  "quality",
  "counting",
  "seal",
  "critique"
 ],
 "properties": {
  "schema": {
   "enum": [
    "famulus-expertise/1"
   ]
  },
  "subject": {
   "type": "object",
   "required": [
    "question",
    "sources",
    "method"
   ],
   "properties": {
    "question": {
     "type": "string",
     "minLength": 10
    },
    "sources": {
     "type": "array",
     "minItems": 1,
     "items": {
      "type": "object",
      "required": [
       "ref",
       "role"
      ],
      "properties": {
       "ref": {
        "type": "string",
        "pattern": "^fr:[A-Za-z0-9_]"
       },
       "role": {
        "enum": [
         "object",
         "witness",
         "literature"
        ]
       },
       "note": {
        "type": "string"
       }
      }
     }
    },
    "work": {
     "type": "string"
    },
    "edition": {
     "type": "string"
    },
    "method": {
     "type": "string",
     "minLength": 10
    },
    "limits": {
     "type": "array",
     "items": {
      "type": "string"
     }
    }
   }
  },
  "claims": {
   "type": "array",
   "minItems": 1,
   "items": {
    "type": "object",
    "required": [
     "id",
     "text",
     "status"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^C[0-9]+$"
     },
     "text": {
      "type": "string",
      "minLength": 10
     },
     "section": {
      "type": "string"
     },
     "status": {
      "enum": [
       "grounded",
       "gap"
      ]
     },
     "grounds": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^fr:[A-Za-z0-9_]"
      }
     },
     "gap": {
      "type": "string"
     },
     "contested": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    }
   }
  },
  "agent": {
   "type": "object",
   "required": [
    "summary",
    "read_first",
    "answers",
    "cite",
    "bibtex",
    "cite_section",
    "sections",
    "use",
    "entry_points"
   ],
   "properties": {
    "summary": {
     "type": "string",
     "minLength": 40,
     "maxLength": 600
    },
    "read_first": {
     "type": "array",
     "minItems": 1,
     "items": {
      "type": "string"
     }
    },
    "answers": {
     "type": "array",
     "minItems": 1,
     "items": {
      "type": "string"
     }
    },
    "terms": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "term",
       "meaning"
      ],
      "properties": {
       "term": {
        "type": "string"
       },
       "meaning": {
        "type": "string"
       }
      }
     }
    },
    "do_not": {
     "type": "array",
     "items": {
      "type": "string"
     }
    },
    "cite": {
     "type": "string",
     "minLength": 20
    },
    "bibtex": {
     "type": "string",
     "pattern": "version = \\{"
    },
    "cite_section": {
     "type": "string",
     "minLength": 20
    },
    "sections": {
     "type": "array",
     "minItems": 1,
     "items": {
      "type": "object",
      "required": [
       "number",
       "title"
      ],
      "properties": {
       "number": {
        "type": "string"
       },
       "title": {
        "type": "string"
       },
       "id": {
        "type": "string"
       }
      }
     }
    },
    "use": {
     "type": "object",
     "required": [
      "licence",
      "may",
      "may_not"
     ],
     "properties": {
      "licence": {
       "type": "string"
      },
      "may": {
       "type": "array",
       "items": {
        "type": "string"
       }
      },
      "may_not": {
       "type": "array",
       "items": {
        "type": "string"
       }
      }
     }
    },
    "entry_points": {
     "type": "object",
     "required": [
      "mcp",
      "tools",
      "resource"
     ],
     "properties": {
      "mcp": {
       "type": "string"
      },
      "tools": {
       "type": "array",
       "items": {
        "type": "string"
       }
      },
      "resource": {
       "type": "string"
      }
     }
    }
   }
  },
  "review": {
   "type": "object",
   "required": [
    "drafted_by"
   ],
   "properties": {
    "drafted_by": {
     "type": "string"
    },
    "confirmed_by": {
     "type": [
      "string",
      "null"
     ]
    },
    "confirmed_on": {
     "type": [
      "string",
      "null"
     ]
    }
   }
  },
  "identity": {
   "type": "object",
   "required": [
    "series",
    "subseries",
    "edition",
    "number",
    "whole_number",
    "id",
    "ref",
    "url",
    "pdf",
    "source",
    "preamble",
    "version",
    "date",
    "status",
    "revisions",
    "language",
    "licence",
    "collections"
   ],
   "properties": {
    "series": {
     "type": "string"
    },
    "subseries": {
     "type": "string"
    },
    "edition": {
     "type": "string"
    },
    "number": {
     "type": "integer",
     "minimum": 1
    },
    "whole_number": {
     "type": "integer",
     "minimum": 1
    },
    "id": {
     "type": "string"
    },
    "ref": {
     "type": "string",
     "pattern": "^fr:expertise/"
    },
    "url": {
     "type": "string",
     "pattern": "^https://"
    },
    "pdf": {
     "type": "string",
     "pattern": "^https://"
    },
    "source": {
     "type": "string",
     "pattern": "^https://"
    },
    "preamble": {
     "type": "string",
     "pattern": "^https://"
    },
    "issn": {
     "type": [
      "string",
      "null"
     ]
    },
    "doi": {
     "type": [
      "string",
      "null"
     ]
    },
    "version": {
     "type": "string"
    },
    "date": {
     "type": "string",
     "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
    },
    "status": {
     "enum": [
      "draft",
      "published",
      "revised",
      "withdrawn"
     ]
    },
    "revisions": {
     "type": "array",
     "minItems": 1,
     "items": {
      "type": "object",
      "required": [
       "version",
       "date",
       "note"
      ]
     }
    },
    "language": {
     "type": "string"
    },
    "licence": {
     "type": "object",
     "required": [
      "name",
      "url"
     ]
    },
    "collections": {
     "type": "array",
     "items": {
      "type": "string"
     }
    }
   }
  },
  "responsibility": {
   "type": "object",
   "required": [
    "authors",
    "editor",
    "publisher",
    "ai_contribution"
   ],
   "properties": {
    "authors": {
     "type": "array",
     "minItems": 1,
     "items": {
      "type": "object",
      "required": [
       "name"
      ]
     }
    },
    "editor": {
     "type": "string"
    },
    "publisher": {
     "type": "object",
     "required": [
      "name",
      "place"
     ]
    },
    "ai_contribution": {
     "type": [
      "string",
      "null"
     ]
    }
   }
  },
  "evidence": {
   "type": "object",
   "required": [
    "references",
    "citations",
    "figures"
   ],
   "properties": {
    "references": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "ref",
       "roles",
       "count"
      ],
      "properties": {
       "ref": {
        "type": "string",
        "pattern": "^fr:"
       },
       "roles": {
        "type": "array",
        "items": {
         "enum": [
          "segment",
          "inline",
          "subject",
          "ground"
         ]
        }
       },
       "count": {
        "type": "integer"
       }
      }
     }
    },
    "citations": {
     "type": "array",
     "items": {
      "type": "string"
     }
    },
    "figures": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "file"
      ]
     }
    }
   }
  },
  "quality": {
   "type": "object",
   "required": [
    "catalogue",
    "run",
    "verdict",
    "counts",
    "open"
   ],
   "properties": {
    "catalogue": {
     "type": "string"
    },
    "run": {
     "type": "string"
    },
    "verdict": {
     "enum": [
      "passed",
      "blocked"
     ]
    },
    "counts": {
     "type": "object"
    },
    "open": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "gate",
       "result"
      ]
     }
    }
   }
  },
  "counting": {
   "type": "object",
   "required": [
    "vgwort"
   ],
   "properties": {
    "vgwort": {
     "type": "string"
    }
   }
  },
  "seal": {
   "type": "object",
   "required": [
    "granted",
    "conditions",
    "missing"
   ],
   "properties": {
    "granted": {
     "type": "boolean"
    },
    "date": {
     "type": [
      "string",
      "null"
     ]
    },
    "version": {
     "type": [
      "string",
      "null"
     ]
    },
    "released_by": {
     "type": [
      "string",
      "null"
     ]
    },
    "conditions": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "id",
       "fulfilled"
      ]
     }
    },
    "missing": {
     "type": "array",
     "items": {
      "type": "string"
     }
    }
   }
  },
  "critique": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "id",
     "version",
     "point",
     "statement",
     "grounds",
     "status"
    ],
    "properties": {
     "status": {
      "enum": [
       "received",
       "under-examination",
       "convincing",
       "not-convincing",
       "withdrawn"
      ]
     }
    }
   }
  }
 }
}