{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "urn:sbv:iso20022:pacs.004.001.10",
  "title": "PaymentReturn — pacs.004.001.10 (SBV profile)",
  "description": "ISO 20022 pacs.004.001.10: Hoàn trả lệnh thanh toán liên ngân hàng",
  "type": "object",
  "required": ["Document"],
  "properties": {
    "Document": {
      "type": "object",
      "required": ["PmtRtr"],
      "properties": {
        "PmtRtr": {
          "type": "object",
          "required": ["GrpHdr", "OrgnlGrpInf"],
          "properties": {
            "GrpHdr": {
              "type": "object",
              "required": ["MsgId", "CreDtTm", "NbOfTxs", "SttlmInf"],
              "properties": {
                "MsgId":    { "type": "string", "maxLength": 35 },
                "CreDtTm":  { "type": "string", "format": "date-time" },
                "NbOfTxs":  { "type": "string", "pattern": "^[0-9]{1,15}$" },
                "TtlRtrdIntrBkSttlmAmt": { "type": "object", "properties": { "_": { "type": "string" }, "$": { "type": "object" } } },
                "SttlmInf": { "type": "object", "required": ["SttlmMtd"], "properties": { "SttlmMtd": { "type": "string", "enum": ["INDA","INGA","COVE","CLRG"] } } }
              }
            },
            "OrgnlGrpInf": {
              "type": "object",
              "required": ["OrgnlMsgId", "OrgnlMsgNmId"],
              "properties": {
                "OrgnlMsgId":   { "type": "string", "maxLength": 35 },
                "OrgnlMsgNmId": { "type": "string", "maxLength": 35 }
              }
            },
            "TxInf": {
              "type": "array",
              "items": {
                "type": "object",
                "required": ["RtrId", "OrgnlEndToEndId", "RtrdIntrBkSttlmAmt"],
                "properties": {
                  "RtrId":               { "type": "string", "maxLength": 35 },
                  "OrgnlEndToEndId":     { "type": "string", "maxLength": 35 },
                  "OrgnlUETR":           { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
                  "RtrdIntrBkSttlmAmt":  { "type": "object", "required": ["_", "$"], "properties": { "_": { "type": "string" }, "$": { "type": "object", "properties": { "Ccy": { "type": "string" } } } } },
                  "RtrRsnInf": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "Rsn": { "type": "object", "properties": { "Cd": { "type": "string", "maxLength": 4 } } }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
