{
  "$id": "https://tcpp.digital/schema/1.3.0/measurement_configuration_request.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "tcpp measurement_configuration_request schema",
  "x-tcpp-version": "1.3.0",
  "description": "tcpp measurement_configuration_request schema",
  "type": "object",
  "properties": {
    "tcpp": {
      "description": "url to tcpp version infos",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 120,
      "pattern": "^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,63}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$"
    },
    "head": {
      "$ref": "#/$defs/definition_head"
    },
    "record": {
      "description": "'record_type':'measurement_configuration', 'record_direction':'request'",
      "type": "object",
      "properties": {
        "mcr_id": {
          "description": "id of mcr",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "mcr_sign": {
          "description": "MEASUREMENT.CHARGEPOINT.AC|MEASUREMENT.CHARGEPOINT.DC|MEASUREMENT.SUBMETER.AC|...",
          "type": "string",
          "minLength": 5,
          "maxLength": 50,
          "pattern": "^[0-9A-Z._\\-]*$"
        },
        "mcr_created_udt": {
          "description": "created MCR, universal datetime",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "mcr_changed_udt": {
          "description": "changed MCR, universal datetime",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "mcr_deactivated_udt": {
          "description": "deactivated MCR, universal datetime",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "mcr_deactivated_next_mcr_id": {
          "description": "id of next mcr if this is deactivated",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "mcr_status": {
          "description": "CREATED|CHANGED|...",
          "type": "string",
          "minLength": 5,
          "maxLength": 50,
          "pattern": "^[0-9A-Z._\\-]*$"
        },
        "mcr_active_sign": {
          "description": "ACTIVE|DEACTIVE.MANUAL|DEACTIVE.CHANGE|DEACTIVE.EXCEPTION",
          "type": "string",
          "minLength": 5,
          "maxLength": 50,
          "pattern": "^[0-9A-Z._\\-]*$"
        },
        "identification": {
          "description": "variable values needed based on 'mcr_sign': f.e. 'module_name', 'module'id', 'module'sign', ... ",
          "type": [
            "object",
            "null"
          ]
        },
        "documentation": {
          "description": "Related documentations,...",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "properties": {
              "documentation_sign": {
                "description": "EU.TEC|...",
                "type": "string",
                "minLength": 3,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "documentation_id": {
                "description": "id of document",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "documentation_name": {
                "description": "name of document, not nec.",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "issuer_sign": {
                "description": "AUTHORITY|MANUFACTURER|COMPANY|ORGANISATION",
                "type": "string",
                "minLength": 3,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "issuer_name": {
                "description": "name of issuer",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "issuer_id": {
                "description": "id of issuer",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "created_date": {
                "description": "date of documentation created",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "effective_date": {
                "description": "date of start effective",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "expire_date": {
                "description": "date of expiring",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "file_name": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "file_id": {
                "description": "id of file",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "file_size": {
                "description": "size of file in bytes",
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "multipleOf": 1
              },
              "file_host": {
                "description": "file found at host",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              }
            },
            "required": [
              "documentation_sign",
              "documentation_id",
              "issuer_sign",
              "issuer_name",
              "created_date",
              "effective_date",
              "expire_date",
              "file_name",
              "file_id",
              "file_size"
            ]
          }
        },
        "equipment": {
          "description": "detected/configurated equipment",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "properties": {
              "equipment_name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Name of Equipment",
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "equipment_sign": {
                "description": "MODULE{.DISPLAY}|CABLE{.CHARGING}|IO{.READER}|...",
                "type": "string",
                "minLength": 3,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "equipment_id": {
                "description": "id of equipment",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "equipment_cid": {
                "description": "chip id of equipment",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "equipment_manufacturer_id": {
                "description": "manufacturer id",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "equipment_manufacturer_name": {
                "description": "name of manufacturer, not nec.",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "detection_sign": {
                "description": "AUTO.SE|AUTO.TPM|MANUAL.MODULE",
                "type": "string",
                "minLength": 3,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "detection_udt": {
                "description": "universal datetime",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "detection_payload": {
                "description": "the umbrella, if umbrella {Empty}=no umbrella|JWS",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "detection_details": {
                "description": "details depending on detection method, f.e.: typ|crv|alg|kid|signature|publickey...",
                "type": [
                  "object",
                  "null"
                ]
              },
              "detection_certificateChain": {
                "description": "certChainRef|root|device|intermediate|...",
                "type": [
                  "object",
                  "null"
                ]
              }
            },
            "required": [
              "equipment_sign",
              "equipment_id",
              "equipment_cid",
              "equipment_manufacturer_id",
              "detection_sign"
            ]
          }
        },
        "software": {
          "description": "Software modules",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "properties": {
              "software_sign": {
                "description": "OPERATING.CONTROLUNIT|...",
                "type": "string",
                "minLength": 3,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "software_id": {
                "description": "id of issuer",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "software_name": {
                "description": "name of software, not nec.",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "issuer_sign": {
                "description": "AUTHORITY.MEASUREMENT.NAME|MANUFACTURER.SELFCERTIFICATION.CE|...",
                "type": "string",
                "minLength": 3,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "issuer_name": {
                "description": "name of issuer",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "issuer_id": {
                "description": "id of issuer",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "created_date": {
                "description": "date of documentation created",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "effective_date": {
                "description": "date of start effective",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "expire_date": {
                "description": "date of expiring",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "file_name": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "file_id": {
                "description": "id of file",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "file_host": {
                "description": "file found at host",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "file_size": {
                "description": "size of file in bytes",
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "multipleOf": 1
              },
              "hash_type": {
                "description": "hash of file type, f.e. SHA-256",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "hash_pattern": {
                "description": "hash of file type, min-length and pattern",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120
              },
              "hash_value": {
                "description": "hash of file value ",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 4096,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "proofed_sign": {
                "description": "PROOFED.VALID|PROOFED.NOTVALID|UNPROOFED.INTENT|UNPROOFED.ERROR|UNPROOFED.OPEN...",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 3,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "proofed_udt": {
                "description": "universal datetime",
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "proofed_id": {
                "description": "id proofed",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              }
            },
            "required": [
              "software_sign",
              "software_id",
              "issuer_sign",
              "issuer_id",
              "created_date",
              "effective_date",
              "expire_date",
              "hash_type",
              "hash_value",
              "hash_pattern",
              "proofed_sign",
              "proofed_udt"
            ]
          }
        }
      },
      "required": [
        "mcr_id",
        "mcr_sign",
        "mcr_created_udt",
        "mcr_changed_udt",
        "mcr_status",
        "mcr_active_sign",
        "identification",
        "documentation",
        "equipment",
        "software"
      ]
    },
    "participants": {
      "description": "participants of process or communication",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/definition_participant"
      }
    },
    "references": {
      "description": "references to request or process(es)",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "properties": {
          "reference_id": {
            "description": "id of internal reference / can be empty",
            "type": [
              "string",
              "null"
            ],
            "minLength": 0,
            "maxLength": 120,
            "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
          },
          "head": {
            "description": "referencing head 1:1",
            "$ref": "#/$defs/definition_head"
          },
          "jws": {
            "description": "jws signature",
            "type": [
              "object",
              "null"
            ]
          }
        },
        "required": [
          "reference_id",
          "head"
        ]
      }
    }
  },
  "required": [
    "tcpp",
    "head",
    "record",
    "references"
  ],
  "$defs": {
    "definition_head": {
      "description": "unified head informations",
      "type": "object",
      "properties": {
        "record_type": {
          "description": "tcpp record",
          "type": "string",
          "minLength": 3,
          "maxLength": 50,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "record_direction": {
          "description": "request|response|internal",
          "type": "string",
          "minLength": 3,
          "maxLength": 8,
          "pattern": "^[a-z]*$"
        },
        "record_udt": {
          "description": "universal datetime",
          "type": "string",
          "format": "date-time"
        },
        "record_pagination": {
          "description": "unique creating number",
          "type": "number",
          "minimum": 1,
          "multipleOf": 1
        },
        "record_version": {
          "description": "version",
          "type": "string",
          "minLength": 5,
          "maxLength": 10,
          "default": "1.3.0",
          "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
        },
        "origin_type": {
          "description": "tcpp type of origin",
          "type": "string",
          "minLength": 3,
          "maxLength": 3,
          "pattern": "^[A-Z]*$"
        },
        "origin_id": {
          "description": "tcpp id of origin",
          "type": "string",
          "minLength": 3,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "target_type": {
          "description": "tcpp type of target",
          "type": "string",
          "minLength": 3,
          "maxLength": 3,
          "pattern": "^[A-Z]*$"
        },
        "target_id": {
          "description": "tcpp id of target",
          "type": "string",
          "minLength": 3,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "context_type": {
          "description": "tcpp type of context / can be empty",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 3,
          "pattern": "^[A-Z]*$"
        },
        "context_id": {
          "description": "id of context / can be empty",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "error_code": {
          "description": "tcpp error handling, Hex",
          "type": "string",
          "pattern": "^[0-9A-F]{6}$"
        },
        "error_text": {
          "description": "tcpp error text (optional)",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        }
      },
      "required": [
        "record_type",
        "record_direction",
        "record_udt",
        "record_pagination",
        "record_version",
        "origin_type",
        "origin_id",
        "target_type",
        "target_id",
        "context_id",
        "context_type",
        "error_code"
      ]
    },
    "definition_participant": {
      "description": "unified participant informations",
      "type": "object",
      "properties": {
        "participant_type": {
          "description": "tcpp type",
          "type": "string",
          "minLength": 3,
          "maxLength": 3,
          "pattern": "^[A-Z]*$"
        },
        "participant_id": {
          "description": "tcpp id",
          "type": "string",
          "minLength": 3,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "participant_perms": {
          "description": "rights/functions of participation",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "description": "read|control|push|broker|...",
            "minLength": 3,
            "maxLength": 10,
            "pattern": "^[a-z]*$"
          }
        },
        "forwarder_type": {
          "description": "forwarder type",
          "type": [
            "string",
            "null"
          ],
          "minLength": 3,
          "maxLength": 3,
          "pattern": "^[A-Z]*$"
        },
        "forwarder_id": {
          "description": "forwarder id",
          "type": [
            "string",
            "null"
          ],
          "minLength": 3,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "approver_type": {
          "description": "approved by type",
          "type": [
            "string",
            "null"
          ],
          "minLength": 3,
          "maxLength": 3,
          "pattern": "^[A-Z]*$"
        },
        "approver_id": {
          "description": "approved by id",
          "type": [
            "string",
            "null"
          ],
          "minLength": 3,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        }
      },
      "required": [
        "participant_type",
        "participant_id",
        "participant_perms",
        "approver_type",
        "approver_id"
      ]
    }
  }
}
