{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "urn:sbv:iso20022:camt.053.001.10",
  "title": "BankToCustomerStatement — camt.053.001.10 (SBV profile)",
  "description": "ISO 20022 camt.053.001.10: Sao kê tài khoản định kỳ",
  "type": "object",
  "required": ["Document"],
  "properties": {
    "Document": {
      "type": "object",
      "required": ["BkToCstmrStmt"],
      "properties": {
        "BkToCstmrStmt": {
          "type": "object",
          "required": ["GrpHdr", "Stmt"],
          "properties": {
            "GrpHdr": {
              "type": "object",
              "required": ["MsgId", "CreDtTm", "MsgPgntn"],
              "properties": {
                "MsgId":    { "type": "string", "maxLength": 35 },
                "CreDtTm":  { "type": "string", "format": "date-time" },
                "MsgPgntn": { "type": "object", "required": ["PgNb","LastPgInd"], "properties": { "PgNb": { "type": "string" }, "LastPgInd": { "type": "boolean" } } }
              }
            },
            "Stmt": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "object",
                "required": ["Id", "Acct", "Bal"],
                "properties": {
                  "Id":       { "type": "string", "maxLength": 35 },
                  "ElctrncSeqNb": { "type": "number" },
                  "CreDtTm":  { "type": "string", "format": "date-time" },
                  "FrToDt":   { "type": "object", "properties": { "FrDtTm": { "type": "string" }, "ToDtTm": { "type": "string" } } },
                  "Acct": {
                    "type": "object",
                    "required": ["Id"],
                    "properties": {
                      "Id":   { "type": "object", "properties": { "Othr": { "type": "object", "properties": { "Id": { "type": "string" } } } } },
                      "Ccy":  { "type": "string", "pattern": "^[A-Z]{3}$" },
                      "Ownr": { "type": "object", "properties": { "Nm": { "type": "string", "maxLength": 140 } } },
                      "Svcr": { "type": "object", "properties": { "FinInstnId": { "type": "object", "properties": { "BICFI": { "type": "string" } } } } }
                    }
                  },
                  "Bal": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": ["Tp", "Amt", "CdtDbtInd", "Dt"],
                      "properties": {
                        "Tp":        { "type": "object", "properties": { "CdOrPrtry": { "type": "object", "properties": { "Cd": { "type": "string" } } } } },
                        "Amt":       { "type": "object", "required": ["_", "$"], "properties": { "_": { "type": "string" }, "$": { "type": "object", "properties": { "Ccy": { "type": "string" } } } } },
                        "CdtDbtInd": { "type": "string", "enum": ["CRDT","DBIT"] },
                        "Dt":        { "type": "object", "properties": { "Dt": { "type": "string", "format": "date" } } }
                      }
                    }
                  },
                  "Ntry": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["Amt", "CdtDbtInd", "Sts", "BookgDt"],
                      "properties": {
                        "Amt":        { "type": "object", "required": ["_","$"], "properties": { "_": { "type": "string" }, "$": { "type": "object", "properties": { "Ccy": { "type": "string" } } } } },
                        "CdtDbtInd":  { "type": "string", "enum": ["CRDT","DBIT"] },
                        "Sts":        { "type": "object", "properties": { "Cd": { "type": "string", "enum": ["BOOK","PDNG","INFO"] } } },
                        "BookgDt":    { "type": "object", "properties": { "Dt": { "type": "string", "format": "date" } } },
                        "ValDt":      { "type": "object", "properties": { "Dt": { "type": "string", "format": "date" } } },
                        "AcctSvcrRef":{ "type": "string", "maxLength": 35 },
                        "NtryDtls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "TxDtls": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "Refs":  { "type": "object", "properties": { "EndToEndId": { "type": "string" }, "UETR": { "type": "string" } } },
                                    "RmtInf":{ "type": "object", "properties": { "Ustrd": { "type": "array", "items": { "type": "string", "maxLength": 140 } } } }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
