{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gxplex.com/api/v1/schema/precedents.json",
  "title": "Enforcement action document",
  "description": "The document served at /api/v1/precedents.json. Items are carried under `items`.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://gxplex.com/api/v1/schema/envelope.json"
    }
  ],
  "properties": {
    "collection": {
      "const": "precedents"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/item"
      },
      "description": "Every enforcement action this document carries."
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": true,
  "$defs": {
    "item": {
      "type": "object",
      "title": "Enforcement action",
      "description": "A published enforcement action and the provisions it cited. It states what was cited and nothing more. No natural person is recorded.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The identifier of this action."
        },
        "date": {
          "type": "string",
          "format": "date",
          "description": "The day the action is dated."
        },
        "authority": {
          "type": "string",
          "description": "The body that took it."
        },
        "action_type": {
          "type": "string",
          "description": "What kind of action the authority calls it."
        },
        "entity_name": {
          "type": "string",
          "description": "The organisation named. Bodies only."
        },
        "entity_type": {
          "type": "string",
          "description": "The kind of organisation."
        },
        "subject_tags": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Subjects recorded against the action."
        },
        "cited_provisions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The provisions the action cites."
        },
        "one_line_factual": {
          "type": "string",
          "description": "What the action states, in one line, without evaluation."
        },
        "source_url": {
          "type": "string",
          "description": "Where the action is published."
        }
      },
      "required": [
        "id",
        "date",
        "authority",
        "source_url"
      ],
      "additionalProperties": true
    }
  }
}
