{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/invoicecraftly/main/json-schema/invoicecraftly-structured-artifact-response-schema.json",
  "title": "StructuredArtifactResponse",
  "x-generated": "2026-09-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/invoicecraftly-openapi.json#/components/schemas/StructuredArtifactResponse",
  "allOf": [
    {
      "$ref": "#/$defs/ReadinessResponse"
    },
    {
      "type": "object",
      "required": [
        "artifact"
      ],
      "properties": {
        "artifact": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "mediaType",
                "content"
              ],
              "properties": {
                "mediaType": {
                  "type": "string",
                  "const": "application/xml"
                },
                "content": {
                  "type": "string",
                  "description": "EN16931-core UBL/XML when ready."
                }
              }
            }
          ]
        }
      }
    }
  ],
  "$defs": {
    "ReadinessResponse": {
      "type": "object",
      "required": [
        "apiVersion",
        "profileId",
        "specificationIdentifier",
        "ready",
        "gaps"
      ],
      "properties": {
        "apiVersion": {
          "type": "string",
          "const": "v1"
        },
        "profileId": {
          "type": "string"
        },
        "specificationIdentifier": {
          "type": "string"
        },
        "ready": {
          "type": "boolean"
        },
        "gaps": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    }
  }
}