{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/myleadtech-app/json-schema/myleadtech-app-catalog-reader-out-schema.json",
  "title": "CatalogReaderOut",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/myleadtech-app-openapi.json#/components/schemas/CatalogReaderOut",
  "properties": {
    "request_id": {
      "type": "string",
      "title": "Request Id"
    },
    "contract_version": {
      "type": "string",
      "title": "Contract Version",
      "default": "catalog-v1/2"
    },
    "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": {
      "$ref": "#/$defs/LibraryDoc"
    },
    "brand": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Brand"
    },
    "brand_label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Brand Label"
    },
    "printed_labels": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "title": "Printed Labels"
    },
    "toc": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Toc",
      "description": "sommaire source s'il existe ; vide sinon, jamais inventé"
    },
    "formats": {
      "items": {
        "type": "string",
        "const": "png"
      },
      "type": "array",
      "title": "Formats"
    },
    "text_search": {
      "$ref": "#/$defs/ReaderTextSearch"
    },
    "hd": {
      "$ref": "#/$defs/ReaderHd"
    },
    "context": {
      "anyOf": [
        {
          "$ref": "#/$defs/ReaderContext"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "request_id",
    "service_revision",
    "publication",
    "status",
    "usage",
    "document",
    "text_search",
    "hd"
  ],
  "$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"
    },
    "LibraryDoc": {
      "properties": {
        "document_version_id": {
          "type": "string",
          "title": "Document Version Id"
        },
        "title": {
          "type": "string",
          "title": "Title",
          "description": "titre source nettoyé, sinon repli déterministe (title_is_fallback)"
        },
        "title_is_fallback": {
          "type": "boolean",
          "title": "Title Is Fallback"
        },
        "publication_ref": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Publication Ref"
        },
        "document_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Document Type"
        },
        "group": {
          "type": "string",
          "enum": [
            "installation",
            "service",
            "wiring",
            "product_data",
            "owner",
            "other"
          ],
          "title": "Group"
        },
        "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"
        },
        "linked_to_models": {
          "type": "boolean",
          "title": "Linked To Models",
          "description": "vrai si l'édition est reliée à au moins un produit (toute marque)"
        },
        "scope": {
          "type": "string",
          "enum": [
            "model",
            "series",
            "selected_models",
            "brand_library"
          ],
          "title": "Scope"
        },
        "series_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Series Label"
        },
        "linked_model_count": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Linked Model Count",
          "description": "produits du périmètre reliés à cette édition"
        },
        "condition_to_check": {
          "type": "boolean",
          "title": "Condition To Check"
        },
        "restrictions": {
          "anyOf": [
            {
              "$ref": "#/$defs/Restrictions"
            },
            {
              "type": "null"
            }
          ],
          "description": "seulement pour un produit précis"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "document_version_id",
        "title",
        "title_is_fallback",
        "group",
        "linked_to_models",
        "scope",
        "linked_model_count",
        "condition_to_check"
      ],
      "title": "LibraryDoc"
    },
    "Publication": {
      "properties": {
        "branch": {
          "type": "string",
          "title": "Branch"
        },
        "snapshot_ref": {
          "type": "string",
          "title": "Snapshot Ref"
        }
      },
      "type": "object",
      "required": [
        "branch",
        "snapshot_ref"
      ],
      "title": "Publication"
    },
    "ReaderContext": {
      "properties": {
        "product_id": {
          "type": "string",
          "title": "Product Id"
        },
        "reference": {
          "type": "string",
          "title": "Reference"
        },
        "brand": {
          "type": "string",
          "title": "Brand"
        },
        "brand_label": {
          "type": "string",
          "title": "Brand Label"
        },
        "kind": {
          "type": "string",
          "enum": [
            "model",
            "generic"
          ],
          "title": "Kind",
          "description": "référence exacte ou générique : le lecteur ne dit jamais « modèle exact » d'une générique"
        },
        "linked": {
          "type": "boolean",
          "title": "Linked",
          "description": "faux si cette édition n'est pas reliée au produit : aucune applicabilité affichée"
        },
        "scope": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "model",
                "series"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Scope"
        },
        "series_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Series Label"
        },
        "condition_to_check": {
          "type": "boolean",
          "title": "Condition To Check",
          "default": false
        },
        "restrictions": {
          "anyOf": [
            {
              "$ref": "#/$defs/Restrictions"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "product_id",
        "reference",
        "brand",
        "brand_label",
        "kind",
        "linked"
      ],
      "title": "ReaderContext"
    },
    "ReaderHd": {
      "properties": {
        "available": {
          "type": "boolean",
          "title": "Available"
        },
        "dpi": {
          "type": "integer",
          "exclusiveMinimum": 0.0,
          "title": "Dpi"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "available",
        "dpi"
      ],
      "title": "ReaderHd"
    },
    "ReaderTextSearch": {
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "available",
            "partial",
            "unavailable"
          ],
          "title": "Status"
        },
        "indexed_pages": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Indexed Pages"
        },
        "page_count": {
          "anyOf": [
            {
              "type": "integer",
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Page Count"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "status",
        "indexed_pages"
      ],
      "title": "ReaderTextSearch"
    },
    "Restrictions": {
      "properties": {
        "series": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Series"
        },
        "board": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Board"
        },
        "firmware": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Firmware"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Note",
          "description": "note client en anglais ; l'annotation interne du pipeline n'est jamais renvoyée brute"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "Restrictions"
    }
  }
}