{
    "type": "array",
    "$schema": "http://json-schema.org/draft-06/schema#",
    "title": "ePP Payment Order Bulk Insert",
    "description": "https://epp.trezor.gov.rs/docs/user/payment-orders/input/#struktura-json-fajla",
    "version": "2.1",
    "items": {
        "type": "object",
        "properties": {
            "Amount": {
                "title": "Iznos",
                "oneOf": [{
                        "type": "number",
                        "exclusiveMinimum": 0
                    },
                    {
                        "type": "string",
                        "pattern": "^[ ]*[0-9,]+([.][0-9]*)?[ ]*$"
                    }
                ]
            },
            "Comment": {
                "title": "Komentar",
                "type": ["string", "null"],
                "maxLength": 1024
            },
            "CreditorAddress": {
                "title": "Adresa primaoca",
                "type": ["string", "null"],
                "maxLength": 256
            },
            "CreditorBankAccount": {
                "title": "Račun primaoca",
                "type": "string",
                "minLength": 6,
                "maxLength": 18,
                "pattern": "^[0-9-]+$"
            },
            "CreditorCode": {
                "title": "Poziv na broj odobrenja (PBO)",
                "type": ["string", "null"],
                "maxLength": 23
            },
            "CreditorCodeModel": {
                "title": "Model PBO",
                "oneOf": [{
                        "type": "integer",
                        "enum": [11, 97]
                    },
                    {
                        "type": "null"
                    },
                    {
                        "type": "string",
                        "enum": [""]
                    },
                    {
                        "type": "string",
                        "pattern": "^[ ]*11|97[ ]*$"
                    }
                ]
            },
            "CreditorName": {
                "title": "Naziv primaoca",
                "type": "string",
                "minLength": 1,
                "maxLength": 256
            },
            "DebtorBankAccount": {
                "title": "Broj računa dužnika",
                "type": "string",
                "minLength": 6,
                "maxLength": 18,
                "pattern": "^[0-9-]+$"
            },
            "DebtorCode": {
                "title": "Poziv na broj zaduženja (PBZ)",
                "type": ["string", "null"],
                "maxLength": 23
            },
            "DebtorCodeModel": {
                "title": "Model PBZ",
                "oneOf": [{
                        "type": "integer",
                        "enum": [11, 97]
                    },
                    {
                        "type": "null"
                    },
                    {
                        "type": "string",
                        "enum": [""]
                    },
                    {
                        "type": "string",
                        "pattern": "^[ ]*11|97[ ]*$"
                    }
                ]
            },
            "ExpectedPaymentDate": {
                "title": "Očekivani datum plaćanja u ISO8601 formatu",
                "oneOf": [{
                        "type": ["string", "null"],
                        "pattern": "^[ ]*\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(.\\d+)?)?[ ]*$"
                    },
                    {
                        "type": "string",
                        "enum": [""]
                    }
                ]
            },
            "ExternalId": {
                "title": "Eksterni broj naloga",
                "type": ["string", "null"],
                "maxLength": 16
            },
            "PaymentBasis": {
                "title": "Svrha plaćanja",
                "type": "string",
                "minLength": 1,
                "maxLength": 105
            },
            "PaymentCode": {
                "title": "Šifra plaćanja",
                "oneOf": [{
                        "type": "integer",
                        "exclusiveMaximum": 1000,
                        "minimum": 100
                    },
                    {
                        "type": "string",
                        "pattern": "^[ ]*[0-9]{3}[ ]*$"
                    }
                ]

            },
            "UrgentPayment": {
                "title": "Hitno plaćanje",
                "oneOf": [{
                        "type": ["boolean", "null"]
                    },
                    {
                        "type": "string",
                        "pattern": "^[ ]*[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee][ ]*$"
                    }
                ]
            },
            "UserGroupName": {
                "title": "Naziv korisničke grupe",
                "type": ["string", "null"],
                "maxLength": 64
            },
            "UserTags": {
                "title": "Niz korisničkih tagova",
                "oneOf": [{
                        "type": ["array"],
                        "maxItems": 5,
                        "items": {
                            "title": "Korisnički tag",
                            "type": "string",
                            "maxLength": 32,
                            "minLength": 3,
                            "pattern": "^[^ \t]+$"
                        }
                    }, {
                        "type": "null"
                    },
                    {
                        "type": "string",
                        "enum": [""]
                    }
                ]

            }
        },
        "required": [
            "Amount",
            "CreditorAddress",
            "CreditorBankAccount",
            "CreditorName",
            "DebtorBankAccount",
            "PaymentBasis",
            "PaymentCode"
        ],
        "additionalProperties": true
    },
    "examples": [
        [{
            "PaymentBasis": "vraćanje sredstava",
            "PaymentCode": 957,
            "Amount": 10000.21,
            "DebtorBankAccount": "840000000000162021",
            "DebtorCodeModel": 97,
            "DebtorCode": "51163732022000075",
            "CreditorName": "Foo D.O.O Beograd",
            "CreditorAddress": "Beograd",
            "CreditorBankAccount": "160000000000000561",
            "CreditorCode": "26-14060-3104-021415",
            "UrgentPayment": true,
            "ExpectedPaymentDate": "2022-01-06",
            "UserTags": [
                "tag1",
                "tag2"
            ]
        }]
    ]
}