{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/myleadtech-app/json-schema/myleadtech-app-document-out-schema.json",
  "title": "DocumentOut",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/myleadtech-app-openapi.json#/components/schemas/DocumentOut",
  "properties": {
    "request_id": {
      "type": "string",
      "title": "Request Id"
    },
    "contract_version": {
      "type": "string",
      "title": "Contract Version",
      "default": "catalog-v1/1"
    },
    "service_revision": {
      "type": "string",
      "title": "Service Revision"
    },
    "publication": {
      "$ref": "#/$defs/Publication"
    },
    "status": {
      "type": "string",
      "title": "Status"
    },
    "partial": {
      "type": "boolean",
      "title": "Partial",
      "default": false
    },
    "missing": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Missing"
    },
    "degraded": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Degraded"
    },
    "usage": {
      "$ref": "#/$defs/CatalogUsage"
    },
    "document_version_id": {
      "type": "string",
      "title": "Document Version Id"
    },
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "document_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Document Type"
    },
    "revision": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Revision"
    },
    "published_on": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Published On"
    },
    "language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Language"
    },
    "page_count": {
      "anyOf": [
        {
          "type": "integer",
          "exclusiveMinimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Page Count"
    },
    "printed_labels": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "title": "Printed Labels",
      "description": "numéro de page PDF -> numéro imprimé (source, jamais fabriqué)"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "request_id",
    "service_revision",
    "publication",
    "status",
    "usage",
    "document_version_id"
  ],
  "$defs": {
    "CatalogUsage": {
      "properties": {
        "operation": {
          "type": "string",
          "title": "Operation"
        },
        "debited": {
          "type": "boolean",
          "title": "Debited"
        },
        "units": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Units"
        },
        "remaining": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Remaining"
        },
        "window_end": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Window End"
        }
      },
      "type": "object",
      "required": [
        "operation",
        "debited"
      ],
      "title": "CatalogUsage"
    },
    "Publication": {
      "properties": {
        "branch": {
          "type": "string",
          "title": "Branch"
        },
        "snapshot_ref": {
          "type": "string",
          "title": "Snapshot Ref"
        }
      },
      "type": "object",
      "required": [
        "branch",
        "snapshot_ref"
      ],
      "title": "Publication"
    }
  }
}