{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.prisme-donnees.fr/depenses-publiques/schemas/contestations.schema.json",
  "title": "Contestations recevables d'une analyse et réponses (docs/04, § 8.2)",
  "type": "object",
  "required": [
    "contestations"
  ],
  "additionalProperties": false,
  "properties": {
    "contestations": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "date",
          "page",
          "auteur",
          "objet",
          "statut"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9._-]*$"
          },
          "date": {
            "type": "string",
            "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
          },
          "page": {
            "type": "string",
            "pattern": "^/"
          },
          "auteur": {
            "type": "string",
            "minLength": 1
          },
          "objet": {
            "type": "string",
            "minLength": 1
          },
          "statut": {
            "type": "string",
            "enum": [
              "recue",
              "en_examen",
              "acceptee",
              "partiellement_acceptee",
              "rejetee"
            ]
          },
          "reponse": {
            "type": "string"
          },
          "date_reponse": {
            "type": "string",
            "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
          },
          "correction": {
            "type": "string"
          }
        }
      }
    }
  }
}
