{
  "$id": "https://tcpp.digital/schema/1.3.0/trigger_get_response.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "tcpp trigger_get_response schema",
  "x-tcpp-version": "1.3.0",
  "description": "tcpp trigger_get_response 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':'trigger_get', 'record_direction':'response'",
      "type": "object",
      "properties": {
        "trigger_sign": {
          "description": "TRIGGER.CLOCK|TRIGGER.STATUS|...",
          "type": "string",
          "minLength": 5,
          "maxLength": 50,
          "pattern": "^[0-9A-Z._\\-]*$"
        },
        "trigger_id": {
          "description": "id of trigger",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "trigger_name": {
          "description": "optional name of trigger",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 250,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "trigger_administrator_id": {
          "description": "optional id of administrator",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 120,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "trigger_administrator_name": {
          "description": "optional name of administrator",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 250,
          "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
        },
        "trigger_status": {
          "description": "ACTIVE|DEACTIVE|ERROR|RESTART",
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "maxLength": 50,
          "pattern": "^[0-9A-Z._\\-]*$"
        },
        "trigger_formulas": {
          "description": "List of formulas action starts",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "properties": {
              "trigger_check_sign": {
                "description": "CLOCK.TIME|CHECK.HARDWARE|...",
                "type": "string",
                "minLength": 5,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "trigger_steps": {
                "description": "f.e. 'CLOCK.TIME': 5 = Every 5 Minutes",
                "type": [
                  "number",
                  "null"
                ]
              },
              "subject_id": {
                "description": "optional id of legal_subject",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "module_id": {
                "description": "optional id of module",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "pause_on_break": {
                "description": "Not try while break/deactive/shutdown/etc...",
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "value_was_changed": {
                "description": "Only send if value was changed",
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "value_min": {
                "description": "if value number/string/boolean arrived a minimum",
                "type": [
                  "number",
                  "string",
                  "boolean",
                  "null"
                ]
              },
              "value_max": {
                "description": "if value number/string/boolean arrived a maximum",
                "type": [
                  "number",
                  "string",
                  "boolean",
                  "null"
                ]
              },
              "value_exact": {
                "description": "if value number/string/boolean arrived a exact value",
                "type": [
                  "number",
                  "string",
                  "boolean",
                  "null"
                ]
              }
            },
            "required": [
              "trigger_check_sign"
            ]
          }
        },
        "trigger_actions": {
          "description": "List of actions start",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "properties": {
              "action_sign": {
                "description": "ACTION.REQUEST|...",
                "type": "string",
                "minLength": 5,
                "maxLength": 50,
                "pattern": "^[0-9A-Z._\\-]*$"
              },
              "action_id": {
                "description": "id of action",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "target_record_type": {
                "description": "tcpp record",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 50,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "target_type": {
                "description": "request to target type",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 3,
                "pattern": "^[A-Z]*$"
              },
              "target_id": {
                "description": "request to target id",
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 0,
                "maxLength": 120,
                "pattern": "^[0-9A-Za-z.,;:%&$#*_/\\-+ !?(){}\\[\\]@~=]*$"
              },
              "action_values": {
                "description": "list of values set to request document or others",
                "type": [
                  "object",
                  "null"
                ]
              }
            },
            "required": [
              "action_sign",
              "action_id"
            ]
          }
        }
      },
      "required": [
        "trigger_sign",
        "trigger_id",
        "trigger_name",
        "trigger_status",
        "trigger_formulas",
        "trigger_actions"
      ]
    },
    "parsed": {
      "description": "element : 000000|FFFFFF|error_code (opt. sub-element-tree error_code)",
      "type": [
        "object",
        "null"
      ],
      "propertyNames": {
        "pattern": "^\\/?.*$"
      },
      "additionalProperties": {
        "type": "string",
        "pattern": "^#?[0-9a-fA-F]{6}$"
      }
    },
    "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"
        ]
      },
      "minItems": 1
    }
  },
  "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"
      ]
    }
  }
}
