{ "$schema":                          "https://json-schema.org/draft/2020-12/schema",
  "$id":                              "https://schemas.mpai.community/PTF/V1.0/data/ProcessLifecycleCredential.json",
  "title":                            "Process Lifecycle Credential V1.0", "description": "Credential describing the lifecycle state of a Process Instance.",
                                      "type": "object", "required": ["Version", "ProcessInstanceID", "LifecycleState", "Issuer", "Validity", "Signature"],
                                      "additionalProperties": false, "properties": {

    "Header":                         { "type": "string", "pattern": "^PTF-PLC-V[0-9]{1,2}[.][0-9]{1,2}$" },
    "MInstanceID":                    { "type": "string" },
    "ProcessLifecycleCredentialID":   { "type": "string" },
    "ProcessLifecycleCredentialTime": { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Time.json" },

    "ProcessInstanceID":              { "type": "string", "description": "Identifier of the Process Instance." },

    "LifecycleState":                 { "type": "string", "enum": [ "Created", "Configured", "Running", "Suspended", "Terminated", "Destroyed" ], 
                                        "description": "Lifecycle state of the Process Instance." },

    "Issuer":                         { "type": "object", "required": ["Name", "KeyID"],
                                        "additionalProperties": false, "properties": {
      "Name":                         { "type": "string", "description": "Human-readable or URI identifier of the issuing authority." },
      "KeyID":                        { "type": "string", "description": "Identifier of the issuer's signing key." } } },

    "Validity":                       { "type": "object", "required": ["NotBefore", "NotAfter"],
                                        "additionalProperties": false, "properties": {
      "NotBefore":                    { "type": "string", "format": "date-time" },
      "NotAfter":                     { "type": "string", "format": "date-time" } } },

    "Evidence":                       { "type": "array", "description": "Optional evidence supporting the lifecycle state.",
                                        "items": { "type": "object", "required": ["Type", "Value"], "additionalProperties": false, "properties": {
        "Type":                       { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/SecurityEvidenceTaxonomy.json#/definitions/EvidenceType",
                                        "description": "Evidence type identifier from the Security Evidence Taxonomy." },
        "Value":                      { "type": "string", "description": "Opaque evidence payload encoded as base64url." },
        "HashAlgorithm":              { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/SecurityAlgorithmTaxonomy.json#/properties/Hash",
                                        "description": "Optional hash algorithm identifier from the Security Algorithm Taxonomy." },
        "HashValue":                  { "type": "string", "description": "Optional hash of the evidence payload (hex or base64url)." } } } },

    "Signature":                      { "type": "object", "required": ["Algorithm", "Value"],
                                        "description": "Digital signature over the PLC using a Signature algo. from the Security Algorithm Taxonomy.",
                                        "additionalProperties": false, "properties": {
      "Algorithm":                    { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/SecurityAlgorithmTaxonomy.json#/properties/Signature",
                                        "description": "Signature algorithm identifier from the Security Algorithm Taxonomy." },
      "Value":                        { "type": "string", "description": "Digital signature value encoded as base64url." } } },

    "DataXMData":                     { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json" },
    "DescrMetadata":                  { "type": "string", "maxLength": 2048 } } }
