{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/toku/json-schema/toku-adjustment-document-with-status-response-schema.json",
  "title": "AdjustmentDocumentWithStatusResponse",
  "description": "Subclass of BaseModel that allows public aliases for fields. _aliases defines aliases in the way \"external\": \"internal\"",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/toku-adjustment-documents-api-openapi.yml#/components/schemas/AdjustmentDocumentWithStatusResponse",
  "properties": {
    "amount": {
      "description": "Monto del documento en la moneda de la Account.",
      "title": "Amount",
      "type": "number"
    },
    "created_at": {
      "description": "Fecha y hora de registro en UTC.",
      "format": "date-time",
      "title": "Created At",
      "type": "string"
    },
    "external_id": {
      "description": "Identificador definido por la organización.",
      "title": "External Id",
      "type": "string"
    },
    "id": {
      "description": "Identificador del documento de ajuste.",
      "title": "Id",
      "type": "string"
    },
    "id_account": {
      "description": "Identificador de la Account.",
      "title": "Id Account",
      "type": "string"
    },
    "id_customer": {
      "description": "Identificador del Customer.",
      "title": "Id Customer",
      "type": "string"
    },
    "id_origin_invoice": {
      "description": "Identificador de la Invoice a la que está ligado el documento, que solo se puede aplicar al pagar esa Invoice. null si se puede aplicar al pagar cualquier Invoice del mismo Customer y Account.",
      "title": "Id Origin Invoice",
      "type": "string"
    },
    "is_void": {
      "default": false,
      "description": "Indica si el documento está anulado. Los documentos anulados se excluyen de la disponibilidad al momento del cobro.",
      "title": "Is Void",
      "type": "boolean"
    },
    "issued_at": {
      "description": "Fecha y hora de emisión del documento (UTC), distinta de la de registro. null si no está definida.",
      "format": "date-time",
      "title": "Issued At",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Metadata de pares clave/valor de formato libre asociada al documento.",
      "title": "Metadata",
      "type": "object"
    },
    "status": {
      "allOf": [
        {
          "$ref": "#/$defs/AdjustmentDocumentStatus"
        }
      ],
      "description": "Estado del documento: `void` si está anulado, `used` si ya se aplicó en un pago exitoso y `available` si todavía se puede aplicar como saldo a favor."
    },
    "type": {
      "allOf": [
        {
          "$ref": "#/$defs/AdjustmentDocumentService_AdjustmentDocumentType"
        }
      ],
      "description": "Categoría del documento: `credit_note` es una nota de crédito emitida al Customer, que rebaja lo que debe, y `supplier_invoice` una factura de proveedor que se descuenta al momento del cobro."
    }
  },
  "required": [
    "id",
    "external_id",
    "type",
    "amount",
    "id_customer",
    "id_account",
    "created_at",
    "status"
  ],
  "type": "object",
  "$defs": {
    "AdjustmentDocumentService_AdjustmentDocumentType": {
      "description": "An enumeration.",
      "enum": [
        "credit_note",
        "supplier_invoice"
      ],
      "title": "AdjustmentDocumentService_AdjustmentDocumentType"
    },
    "AdjustmentDocumentStatus": {
      "description": "Derived, not stored: void > used > available.",
      "enum": [
        "available",
        "used",
        "void"
      ],
      "title": "AdjustmentDocumentStatus",
      "type": "string"
    }
  }
}