{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.fispay.eu/schemas/common/message-header.json",
  "title": "MessageHeader",
  "description": "Envelope fields carried by every message exchanged between the sale system and the payment terminal. They say which protocol revision is spoken, what kind of message this is and which devices and which service exchange it belong to. Placeholder until the real message catalog lands.",
  "x-placeholder": true,
  "type": "object",
  "required": [
    "ProtocolVersion",
    "MessageClass",
    "MessageCategory",
    "MessageType",
    "ServiceID",
    "SaleID",
    "POIID"
  ],
  "properties": {
    "ProtocolVersion": {
      "description": "Revision of the message protocol the sender speaks, as major.minor.",
      "type": "string",
      "minLength": 1,
      "examples": [
        "3.1"
      ]
    },
    "MessageClass": {
      "description": "Broad family of the exchange, for example a service started by the sale system.",
      "type": "string",
      "minLength": 1,
      "examples": [
        "Service"
      ]
    },
    "MessageCategory": {
      "description": "Which operation the message belongs to, for example a diagnosis.",
      "type": "string",
      "minLength": 1,
      "examples": [
        "Diagnosis"
      ]
    },
    "MessageType": {
      "description": "Whether this message asks for something or answers an earlier message.",
      "type": "string",
      "minLength": 1,
      "examples": [
        "Request",
        "Response"
      ]
    },
    "ServiceID": {
      "description": "Identifier chosen by the sale system for this request; the terminal uses it to detect retries (idempotency key). A response repeats the value of its request.",
      "type": "string",
      "minLength": 1,
      "examples": [
        "2041"
      ]
    },
    "SaleID": {
      "description": "Identifier of the sale system (cash register) that takes part in the exchange.",
      "type": "string",
      "minLength": 1,
      "examples": [
        "ECR-01"
      ]
    },
    "POIID": {
      "description": "Identifier of the payment terminal that takes part in the exchange.",
      "type": "string",
      "minLength": 1,
      "examples": [
        "FISPAY-T-0001"
      ]
    }
  }
}
