{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/packetrove-com/json-schema/packetrove-com-certificate-bundle-result-schema.json",
  "title": "CertificateBundleResult",
  "description": "Structural and cryptographic observations about the supplied bundle. Not full RFC 5280 path validation, client trust, revocation checking, or deployment safety. Candidate failures do not invalidate other paths.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/packetrove-com-openapi.json#/components/schemas/CertificateBundleResult",
  "type": "object",
  "properties": {
    "evaluatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Evaluation time from this runtime clock, not a deployment observation."
    },
    "certificates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "Zero-based original input position; duplicates retain their positions."
          },
          "line": {
            "type": "integer",
            "minimum": 1,
            "description": "One-based input line of the BEGIN boundary."
          },
          "subject": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "commonName": {
            "type": [
              "string",
              "null"
            ]
          },
          "serialNumber": {
            "type": "string"
          },
          "sans": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "value"
              ],
              "additionalProperties": false
            }
          },
          "notBefore": {
            "type": "string",
            "format": "date-time"
          },
          "notAfter": {
            "type": "string",
            "format": "date-time"
          },
          "ca": {
            "type": "boolean"
          },
          "basicConstraintsPresent": {
            "type": "boolean"
          },
          "keyCertSign": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "fingerprintSha256": {
            "type": "string",
            "pattern": "^(?:[0-9A-F]{2}:){31}[0-9A-F]{2}$"
          },
          "signatureAlgorithm": {
            "type": "string"
          },
          "selfSignature": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "verified",
              "failed",
              "unsupported",
              "unavailable",
              null
            ],
            "description": "Verification with this certificate's own public key when Subject and Issuer names match. Failed or incomplete verification does not exclude a valid self-issued key-rollover certificate signed by a different key."
          }
        },
        "required": [
          "index",
          "line",
          "subject",
          "issuer",
          "commonName",
          "serialNumber",
          "sans",
          "notBefore",
          "notAfter",
          "ca",
          "basicConstraintsPresent",
          "keyCertSign",
          "fingerprintSha256",
          "signatureAlgorithm",
          "selfSignature"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 16
    },
    "relationships": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "childIndex": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15
          },
          "issuerIndex": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15
          },
          "signature": {
            "type": "string",
            "enum": [
              "verified",
              "failed",
              "unsupported",
              "unavailable"
            ]
          },
          "issuerEligible": {
            "type": "boolean",
            "description": "basicConstraints CA=true and, if present, Key Usage permits keyCertSign. Does not include validity, trust, or full path constraints."
          },
          "keyIdentifierMatch": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "childIndex",
          "issuerIndex",
          "signature",
          "issuerEligible",
          "keyIdentifierMatch"
        ],
        "additionalProperties": false
      },
      "maxItems": 240
    },
    "leafIndexes": {
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 0,
        "maximum": 15
      },
      "maxItems": 16,
      "description": "First occurrences of distinct non-CA certificates; these are possible leaves, not a verified deployment selection."
    },
    "selectedLeafIndex": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 15
    },
    "hostname": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "expected": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "matched",
            "mismatched",
            "ambiguous",
            "no-leaf"
          ]
        }
      },
      "required": [
        "expected",
        "status"
      ],
      "additionalProperties": false
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "DUPLICATE_CERTIFICATE",
              "CERTIFICATE_EXPIRED",
              "CERTIFICATE_NOT_YET_VALID",
              "SELF_SIGNED_CERTIFICATE",
              "SELF_ISSUED_CERTIFICATE",
              "SELF_SIGNATURE_FAILED",
              "SIGNATURE_UNSUPPORTED",
              "SIGNATURE_CHECK_UNAVAILABLE",
              "ISSUER_NOT_IN_BUNDLE",
              "LEAF_ISSUER_NOT_IN_BUNDLE",
              "CANDIDATE_SIGNATURE_FAILED",
              "LEAF_ISSUER_CANDIDATES_REJECTED",
              "ISSUER_NOT_CA",
              "ISSUER_KEY_USAGE_REJECTED",
              "ISSUER_KEY_ID_MISMATCH",
              "MULTIPLE_ISSUERS",
              "LEAF_SELECTION_REQUIRED",
              "NO_LEAF_CERTIFICATE",
              "HOSTNAME_MATCH",
              "HOSTNAME_MISMATCH"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning",
              "info"
            ],
            "description": "Error: a confirmed issue with identified certificates or all supplied issuer candidates for the selected leaf. Warning: a candidate issue or an incomplete requested check. Info: a structural or successful observation. No severity establishes client trust or invalidates every possible path."
          },
          "certificateIndexes": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 15
            },
            "maxItems": 16
          },
          "observed": {
            "type": "string"
          },
          "evidence": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "nextAction": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "severity",
          "certificateIndexes",
          "observed",
          "evidence",
          "nextAction"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "evaluatedAt",
    "certificates",
    "relationships",
    "leafIndexes",
    "selectedLeafIndex",
    "hostname",
    "findings"
  ],
  "additionalProperties": false
}