{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "urn:sbv:iso20022:pacs.002.001.11",
  "title": "FIToFIPaymentStatusReport — pacs.002.001.11 (SBV profile)",
  "description": "ISO 20022 pacs.002.001.11: Báo cáo trạng thái thanh toán liên ngân hàng",
  "type": "object",
  "required": ["Document"],
  "properties": {
    "Document": {
      "type": "object",
      "required": ["FIToFIPmtStsRpt"],
      "properties": {
        "FIToFIPmtStsRpt": {
          "type": "object",
          "required": ["GrpHdr", "OrgnlGrpInfAndSts"],
          "properties": {

            "GrpHdr": {
              "type": "object",
              "required": ["MsgId", "CreDtTm"],
              "properties": {
                "MsgId":   { "type": "string", "maxLength": 35 },
                "CreDtTm": { "type": "string", "format": "date-time" }
              }
            },

            "OrgnlGrpInfAndSts": {
              "type": "object",
              "required": ["OrgnlMsgId", "OrgnlMsgNmId", "GrpSts"],
              "properties": {
                "OrgnlMsgId":   { "type": "string", "maxLength": 35 },
                "OrgnlMsgNmId": { "type": "string", "maxLength": 35 },
                "GrpSts": {
                  "type": "string",
                  "enum": ["ACCP","ACSC","ACSP","ACTC","ACWC","PNDG","RCVD","RJCT"],
                  "description": "ACCP=Accepted, RJCT=Rejected, PNDG=Pending, RCVD=Received"
                },
                "StsRsnInf": {
                  "type": "object",
                  "properties": {
                    "Rsn": { "type": "object", "properties": { "Cd": { "type": "string", "maxLength": 4 } } },
                    "AddtlInf": { "type": "string", "maxLength": 105 }
                  }
                }
              }
            },

            "TxInfAndSts": {
              "type": "array",
              "items": {
                "type": "object",
                "required": ["StsId", "OrgnlEndToEndId", "TxSts"],
                "properties": {
                  "StsId":           { "type": "string", "maxLength": 35 },
                  "OrgnlInstrId":    { "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}$" },
                  "TxSts": {
                    "type": "string",
                    "enum": ["ACCP","ACSC","ACSP","ACTC","ACWC","PNDG","RCVD","RJCT"]
                  },
                  "StsRsnInf": {
                    "type": "object",
                    "properties": {
                      "Rsn": { "type": "object", "properties": { "Cd": { "type": "string" } } },
                      "AddtlInf": { "type": "string", "maxLength": 105 }
                    }
                  }
                }
              }
            }

          }
        }
      }
    }
  }
}
