{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/assinafy-com-br/json-schema/assinafy-com-br-document-contract-amendment-schema.json",
  "title": "DocumentContractAmendment",
  "description": "A document that amends, renews or terminates a contract: its link and the terms it changes. The parent's terms take the delta once this document is certificated; until then the parent is untouched.",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/assinafy-com-br-openapi.json#/components/schemas/DocumentContractAmendment",
  "properties": {
    "resource": {
      "type": "string"
    },
    "document_id": {
      "description": "This document, the instrument.",
      "type": "string"
    },
    "document_name": {
      "description": "This document's name.",
      "type": "string"
    },
    "parent_document_id": {
      "description": "The contract document whose terms change.",
      "type": "string"
    },
    "relation_type": {
      "type": "string",
      "enum": [
        "amendment",
        "renewal",
        "termination"
      ]
    },
    "number": {
      "description": "Position among the parent's applied amendments by signing date; `null` while pending.",
      "type": [
        "integer",
        "null"
      ]
    },
    "status": {
      "description": "`applied` once the delta moved the parent's terms.",
      "type": "string",
      "enum": [
        "pending",
        "applied"
      ]
    },
    "document_status": {
      "description": "This document's own status, so a declined, cancelled or expired instrument shows as such. An instrument applies only while its document is `certificated`: one whose document reads `failed` after it was signed waits, with no `apply_error`, until it is certificated again, and then applies in its place in the signing order.",
      "type": "string"
    },
    "apply_error": {
      "description": "Why a signed instrument has not applied yet, retried every hour: the workspace's plan does not include contract tracking (it applies on the first run after the plan returns), the parent would not take the delta, an instrument signed before this one has not applied yet, one signed after it has already applied (this one then stays blocked: unlink it, and record what it still changes on a new instrument), or an unexpected failure.",
      "type": [
        "string",
        "null"
      ]
    },
    "currency": {
      "description": "The currency of the amounts in `terms` and `changes`. Once applied, the contract's currency at that moment, kept whatever the contract moves to later. While pending (and for an instrument applied before this was kept), the one this instrument moves the contract to, otherwise the contract's. `null` when neither has one.",
      "type": [
        "string",
        "null"
      ]
    },
    "terms": {
      "description": "The delta: only the terms this instrument changes; `null` when it changes none (a termination on the day it is signed).",
      "type": [
        "object",
        "null"
      ]
    },
    "changes": {
      "description": "Every parent field the roll-up moves, as `{from, to}`: a preview while pending, the record once applied; `null` when it moves none.",
      "type": [
        "object",
        "null"
      ]
    },
    "applied_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "type": "object"
}