{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amass-tech/json-schema/amass-tech-regulatory-core-changed-record-schema.json",
  "title": "RegulatoryCoreChangedRecord",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amass-tech-openapi.json#/components/schemas/RegulatoryCoreChangedRecord",
  "type": "object",
  "properties": {
    "amassId": {
      "type": "string"
    },
    "updateType": {
      "type": "string",
      "enum": [
        "created",
        "updated",
        "deleted",
        "unchanged"
      ],
      "description": "What happened to the authorization record itself. `created` when this delivery is its first write, `updated` when its own row moved, `deleted` if it left Drugs@FDA or the EMA register, and `unchanged` when the authorization is byte-identical and the change is entirely in the `documentSections` named alongside it. Re-fetch GET /records/{amassId} for anything but `unchanged`. A withdrawn or suspended authorization is an `updated` with a new `authorizationStatus`, never a `deleted`. To spot a genuinely new authorization, compare `createDate` against your window rather than branching on this — a record created inside your window and revised again later still arrives as `updated`."
    },
    "updateDate": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "description": "When the authorization record itself was last written — its own date, not the delivery's. **It is not guaranteed to fall inside your requested window**: when `updateType` is `unchanged` it is the record's older last write, and the in-window dates are on the `documentSections` entries. For a deletion this is the date the removal was observed. Page on `nextCursor`, never on this. Null only if the record carries no write date at all."
    },
    "createDate": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "description": "When this record first entered Amass, if known. Always null when updateType is `deleted`."
    },
    "documentSections": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RegulatoryCoreChangedDocumentSection"
      },
      "default": [],
      "description": "The parsed source-document sections (FDA labels/reviews, EMA SmPCs/EPARs) behind this delivery, each reporting its own `updateType`, `updateDate` and `createDate`. Advisory rather than exhaustive: it names the sections that surfaced this record *on this page*, so a record whose changed sections span more than one page arrives more than once with a different subset each time. Do not accumulate it — read the record's complete current set from its table of contents on GET /records/{amassId}. Empty when a record-level change alone drove the delivery, and always empty when `updateType` is `deleted`, since every section went with the record."
    }
  },
  "required": [
    "amassId",
    "updateType",
    "updateDate",
    "createDate"
  ],
  "$defs": {
    "RegulatoryCoreChangedDocumentSection": {
      "type": "object",
      "properties": {
        "documentSectionId": {
          "type": "string",
          "description": "The section that changed, addressable in its own right: fetch it with /records/{amassId}/document-sections/{documentSectionId} under the `amassId` this entry names. The id is stable across re-parses of the same section, so it is safe to key a local store on."
        },
        "updateType": {
          "type": "string",
          "enum": [
            "created",
            "updated",
            "deleted"
          ],
          "description": "`created` when the section is new to its source document, `deleted` when it is gone from it, `updated` when its parsed content moved. `deleted` here is about the section, not the record: the authorization is still live and still fetchable, so drop this one section from your store and keep everything else. A `deleted` at the record level — the entry's own `updateType` — never carries `documentSections` at all."
        },
        "updateDate": {
          "type": "string",
          "format": "date",
          "description": "When this section was last written, or removed if `updateType` is `deleted`. The section's own date, not the record's — this is the one that falls inside your requested window when the entry's `updateType` is `unchanged`."
        },
        "createDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "When this section was first seen by Amass. Always null when `updateType` is `deleted` — the row that held it is gone. Approximate for sections ingested before Amass tracked the date."
        }
      },
      "required": [
        "documentSectionId",
        "updateType",
        "updateDate",
        "createDate"
      ]
    }
  }
}