{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ptpge.org/ucp/schemas/identity.json",
  "name": "org.ptpge.print.identity",
  "title": "PTPGE Product Identity",
  "description": "Adds the PTPGE product description — one configuration and the fingerprint computed from it, the open, computable identity of a print product — to UCP checkout line items. The object is product-description/1 (https://ptpge.org/v1/schemas/product-description/1), the same block a PTPGE request and quote carry. Values that name print terms are URIs into the PTPGE vocabulary (https://ptpge.org/v1/), an open vocabulary governed by the PTPGE association and published in dated, additive releases (dataVersion). Vocabulary base: for ptpge-cfs/1 every term is a URI under https://ptpge.org/v1/ and no other base is valid. Vocabulary revision: the Business declares the dataVersion in this capability's config. Unknown terms: a UCP receiver MUST tolerate an unknown URI; it does not break the line, but no identity can be issued for a configuration whose binding is not in the vocabulary (the reference validator refuses to fingerprint it). Deprecated terms: a deprecated URI keeps resolving and names its successor; validators accept it and surface the successor. Resolution unavailable: vocabulary membership is checked against a cached snapshot at the declared dataVersion, so a lookup failure is distinguishable from an unknown term; resolution is never on the transaction's critical path.",
  "version": "2026-11-22",
  "requires": {
    "protocol": {
      "min": "2026-04-08"
    },
    "capabilities": {
      "dev.ucp.shopping.checkout": {
        "min": "2026-04-08"
      }
    }
  },
  "$defs": {
    "termUri": {
      "type": "string",
      "pattern": "^https://ptpge\\.org/v1/(printing|ordering|variables)/[a-z0-9][a-z0-9/-]*$"
    },
    "productUri": {
      "type": "string",
      "pattern": "^https://ptpge\\.org/v1/ordering/products/[a-z0-9][a-z0-9/-]*$"
    },
    "variableUri": {
      "type": "string",
      "pattern": "^https://ptpge\\.org/v1/variables/[a-z0-9][a-z0-9/-]*$"
    },
    "surfaceSlug": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]*$",
      "description": "A face of the bound setup model: front, back, outside, inside, front-cover, inside-pages …"
    },
    "binding": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "variable"
      ],
      "description": "One statement: a variable bound to a term URI, a number (pages, gsm, mm …) or a set/stack of term URIs; surface-scoped when the variable's scope is surface.",
      "properties": {
        "variable": {
          "$ref": "#/$defs/variableUri"
        },
        "value": {
          "oneOf": [
            {
              "$ref": "#/$defs/termUri"
            },
            {
              "type": "number"
            }
          ]
        },
        "values": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/termUri"
          }
        },
        "ordered": {
          "type": "boolean",
          "description": "values is a stack (order significant — lamination under spot varnish), not a set."
        },
        "surface": {
          "$ref": "#/$defs/surfaceSlug"
        }
      },
      "oneOf": [
        {
          "required": [
            "value"
          ]
        },
        {
          "required": [
            "values"
          ]
        }
      ]
    },
    "configuration": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "product",
        "bindings"
      ],
      "properties": {
        "product": {
          "$ref": "#/$defs/productUri"
        },
        "bindings": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/binding"
          }
        }
      }
    },
    "fingerprint_object": {
      "title": "PTPGE fingerprint",
      "type": "object",
      "required": [
        "algorithm",
        "spec"
      ],
      "description": "The identity, in the form every PTPGE document uses. Readers MUST tolerate unknown members and an unknown algorithm; a fingerprint with an unknown algorithm cannot be verified by that reader.",
      "properties": {
        "algorithm": {
          "type": "string",
          "description": "The method as a whole. Well-known value: `ptpge-cfs/1` — the canonical serialization (cfs = configuration fingerprint serialization) hashed with SHA-256, which the method fixes. A later canonical form would be a new value.",
          "examples": [
            "ptpge-cfs/1"
          ]
        },
        "spec": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "SHA-256 over the canonical string of the configuration, lowercase hex: the product itself. Resolvable at https://ptpge.org/f/{spec}; verifiable by recomputation from `configuration`.",
          "examples": [
            "d9baec4a8bd688857e60daee94d51fd890d99cd0a67de0ce92bffb44e475fe37"
          ]
        },
        "request": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "One buyer's ask: spec plus quantity and delivery. Identifies that step, not the product."
        },
        "offer": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "One vendor's answer: request plus the vendor. Identifies that step, not the product."
        }
      }
    },
    "ptpge_identity": {
      "title": "PTPGE Identity",
      "type": "object",
      "required": [
        "fingerprint"
      ],
      "properties": {
        "configuration": {
          "$ref": "#/$defs/configuration",
          "description": "What the product is: the product template and the bindings chosen, as term URIs. With it on the line, a receiver reads the product directly and verifies `fingerprint.spec` by recomputation, without a lookup. Describes the product only (profile spec)."
        },
        "fingerprint": {
          "description": "The identity. Since 2026-11-22 an object, as in every PTPGE document. Until then a bare string beside `profile` and `serialization`; that form remains valid and is deprecated. Readers MUST accept both.",
          "oneOf": [
            {
              "$ref": "#/$defs/fingerprint_object"
            },
            {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$",
              "deprecated": true,
              "description": "Deprecated form (2026-10-19 and earlier): SHA-256 over the canonical serialization, lowercase hex; `profile` says which profile it identifies.",
              "examples": [
                "9027fc4296c43ee07c098af6904736bb8f9d673af0d5dfaea4d9ce6c92c2ad2b"
              ]
            }
          ]
        },
        "profile": {
          "type": "string",
          "deprecated": true,
          "description": "Deprecated with the string form of `fingerprint`: which canonical-form profile that string identifies. Well-known values: `spec`, `request`, `offer`. Readers MUST tolerate unknown values.",
          "examples": [
            "spec",
            "request",
            "offer"
          ]
        },
        "serialization": {
          "type": "string",
          "deprecated": true,
          "description": "Deprecated with the string form of `fingerprint`: the method, now `fingerprint.algorithm`. Well-known value: `ptpge-cfs/1`. Readers MUST tolerate unknown values.",
          "examples": [
            "ptpge-cfs/1"
          ]
        }
      }
    },
    "dev.ucp.shopping.checkout": {
      "title": "Checkout with PTPGE Product Identity",
      "allOf": [
        {
          "$ref": "https://ucp.dev/2026-08-25/schemas/shopping/checkout.json"
        },
        {
          "type": "object",
          "properties": {
            "line_items": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "item": {
                    "type": "object",
                    "properties": {
                      "ptpge": {
                        "$ref": "#/$defs/ptpge_identity"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  }
}
