@endevops/peppol-schema 0.1.1-alpha.2 → 0.1.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"schematron.js","names":["rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_CODES","rule","rule","rule","rule","rule","CREDIT_TRANSFER_CODES","rule","rule","CARD_CODES","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_CODES","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","DATE_REGEX","encodeDateSync","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_CODES","rule","rule","rule","rule","rule","rule","rule","DATE_REGEX","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_SCHEMES","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule"],"sources":["../src/schematron/errors.ts","../src/schematron/helpers.ts","../src/schematron/cen/ae/cen-en16931-br-ae-01.ts","../src/schematron/cen/ae/cen-en16931-br-ae-02.ts","../src/schematron/cen/ae/cen-en16931-br-ae-03.ts","../src/schematron/cen/ae/cen-en16931-br-ae-04.ts","../src/schematron/cen/ae/cen-en16931-br-ae-05.ts","../src/schematron/cen/ae/cen-en16931-br-ae-06.ts","../src/schematron/cen/ae/cen-en16931-br-ae-07.ts","../src/schematron/cen/ae/cen-en16931-br-ae-08.ts","../src/schematron/cen/ae/cen-en16931-br-ae-09.ts","../src/schematron/cen/ae/cen-en16931-br-ae-10.ts","../src/schematron/cen/af/cen-en16931-br-af-01.ts","../src/schematron/cen/af/cen-en16931-br-af-02.ts","../src/schematron/cen/af/cen-en16931-br-af-03.ts","../src/schematron/cen/af/cen-en16931-br-af-04.ts","../src/schematron/cen/af/cen-en16931-br-af-05.ts","../src/schematron/cen/af/cen-en16931-br-af-06.ts","../src/schematron/cen/af/cen-en16931-br-af-07.ts","../src/schematron/cen/af/cen-en16931-br-af-08.ts","../src/schematron/cen/af/cen-en16931-br-af-09.ts","../src/schematron/cen/af/cen-en16931-br-af-10.ts","../src/schematron/cen/ag/cen-en16931-br-ag-01.ts","../src/schematron/cen/ag/cen-en16931-br-ag-02.ts","../src/schematron/cen/ag/cen-en16931-br-ag-03.ts","../src/schematron/cen/ag/cen-en16931-br-ag-04.ts","../src/schematron/cen/ag/cen-en16931-br-ag-05.ts","../src/schematron/cen/ag/cen-en16931-br-ag-06.ts","../src/schematron/cen/ag/cen-en16931-br-ag-07.ts","../src/schematron/cen/ag/cen-en16931-br-ag-08.ts","../src/schematron/cen/ag/cen-en16931-br-ag-09.ts","../src/schematron/cen/ag/cen-en16931-br-ag-10.ts","../src/schematron/cen/b/cen-en16931-br-b-01.ts","../src/schematron/cen/b/cen-en16931-br-b-02.ts","../src/schematron/cen/cen-en16931-br-01.ts","../src/schematron/cen/cen-en16931-br-02.ts","../src/schematron/cen/cen-en16931-br-03.ts","../src/schematron/cen/cen-en16931-br-04.ts","../src/schematron/cen/cen-en16931-br-05.ts","../src/schematron/cen/cen-en16931-br-06.ts","../src/schematron/cen/cen-en16931-br-07.ts","../src/schematron/cen/cen-en16931-br-08.ts","../src/schematron/cen/cen-en16931-br-09.ts","../src/schematron/cen/cen-en16931-br-10.ts","../src/schematron/cen/cen-en16931-br-11.ts","../src/schematron/cen/cen-en16931-br-12.ts","../src/schematron/cen/cen-en16931-br-13.ts","../src/schematron/cen/cen-en16931-br-14.ts","../src/schematron/cen/cen-en16931-br-15.ts","../src/schematron/cen/cen-en16931-br-16.ts","../src/schematron/cen/cen-en16931-br-17.ts","../src/schematron/cen/cen-en16931-br-18.ts","../src/schematron/cen/cen-en16931-br-19.ts","../src/schematron/cen/cen-en16931-br-20.ts","../src/schematron/cen/cen-en16931-br-21.ts","../src/schematron/cen/cen-en16931-br-22.ts","../src/schematron/cen/cen-en16931-br-23.ts","../src/schematron/cen/cen-en16931-br-24.ts","../src/schematron/cen/cen-en16931-br-25.ts","../src/schematron/cen/cen-en16931-br-26.ts","../src/schematron/cen/cen-en16931-br-27.ts","../src/schematron/cen/cen-en16931-br-28.ts","../src/schematron/cen/cen-en16931-br-29.ts","../src/schematron/cen/cen-en16931-br-30.ts","../src/schematron/cen/cen-en16931-br-31.ts","../src/schematron/cen/cen-en16931-br-32.ts","../src/schematron/cen/cen-en16931-br-33.ts","../src/schematron/cen/cen-en16931-br-36.ts","../src/schematron/cen/cen-en16931-br-37.ts","../src/schematron/cen/cen-en16931-br-38.ts","../src/schematron/cen/cen-en16931-br-41.ts","../src/schematron/cen/cen-en16931-br-42.ts","../src/schematron/cen/cen-en16931-br-43.ts","../src/schematron/cen/cen-en16931-br-44.ts","../src/schematron/cen/cen-en16931-br-45.ts","../src/schematron/cen/cen-en16931-br-46.ts","../src/schematron/cen/cen-en16931-br-47.ts","../src/schematron/cen/cen-en16931-br-48.ts","../src/schematron/cen/cen-en16931-br-49.ts","../src/schematron/cen/cen-en16931-br-50.ts","../src/schematron/cen/cen-en16931-br-51.ts","../src/schematron/cen/cen-en16931-br-52.ts","../src/schematron/cen/cen-en16931-br-53.ts","../src/schematron/cen/cen-en16931-br-54.ts","../src/schematron/cen/cen-en16931-br-55.ts","../src/schematron/cen/cen-en16931-br-56.ts","../src/schematron/cen/cen-en16931-br-57.ts","../src/schematron/cen/cen-en16931-br-61.ts","../src/schematron/cen/cen-en16931-br-62.ts","../src/schematron/cen/cen-en16931-br-63.ts","../src/schematron/cen/cen-en16931-br-64.ts","../src/schematron/cen/cen-en16931-br-65.ts","../src/schematron/cen/cl/cen-en16931-br-cl-08.ts","../src/schematron/cen/co/cen-en16931-br-co-03.ts","../src/schematron/cen/co/cen-en16931-br-co-04.ts","../src/schematron/cen/co/cen-en16931-br-co-05.ts","../src/schematron/cen/co/cen-en16931-br-co-06.ts","../src/schematron/cen/co/cen-en16931-br-co-07.ts","../src/schematron/cen/co/cen-en16931-br-co-08.ts","../src/schematron/cen/co/cen-en16931-br-co-09.ts","../src/schematron/cen/co/cen-en16931-br-co-10.ts","../src/schematron/cen/co/cen-en16931-br-co-11.ts","../src/schematron/cen/co/cen-en16931-br-co-12.ts","../src/schematron/cen/co/cen-en16931-br-co-13.ts","../src/schematron/cen/co/cen-en16931-br-co-14.ts","../src/schematron/cen/co/cen-en16931-br-co-15.ts","../src/schematron/cen/co/cen-en16931-br-co-16.ts","../src/schematron/cen/co/cen-en16931-br-co-17.ts","../src/schematron/cen/co/cen-en16931-br-co-18.ts","../src/schematron/cen/co/cen-en16931-br-co-19.ts","../src/schematron/cen/co/cen-en16931-br-co-20.ts","../src/schematron/cen/co/cen-en16931-br-co-21.ts","../src/schematron/cen/co/cen-en16931-br-co-22.ts","../src/schematron/cen/co/cen-en16931-br-co-23.ts","../src/schematron/cen/co/cen-en16931-br-co-24.ts","../src/schematron/cen/co/cen-en16931-br-co-25.ts","../src/schematron/cen/co/cen-en16931-br-co-26.ts","../src/schematron/cen/dec/cen-en16931-br-dec-01.ts","../src/schematron/cen/dec/cen-en16931-br-dec-02.ts","../src/schematron/cen/dec/cen-en16931-br-dec-05.ts","../src/schematron/cen/dec/cen-en16931-br-dec-06.ts","../src/schematron/cen/dec/cen-en16931-br-dec-09.ts","../src/schematron/cen/dec/cen-en16931-br-dec-10.ts","../src/schematron/cen/dec/cen-en16931-br-dec-11.ts","../src/schematron/cen/dec/cen-en16931-br-dec-12.ts","../src/schematron/cen/dec/cen-en16931-br-dec-13.ts","../src/schematron/cen/dec/cen-en16931-br-dec-14.ts","../src/schematron/cen/dec/cen-en16931-br-dec-15.ts","../src/schematron/cen/dec/cen-en16931-br-dec-16.ts","../src/schematron/cen/dec/cen-en16931-br-dec-17.ts","../src/schematron/cen/dec/cen-en16931-br-dec-18.ts","../src/schematron/cen/dec/cen-en16931-br-dec-19.ts","../src/schematron/cen/dec/cen-en16931-br-dec-20.ts","../src/schematron/cen/dec/cen-en16931-br-dec-23.ts","../src/schematron/cen/dec/cen-en16931-br-dec-24.ts","../src/schematron/cen/dec/cen-en16931-br-dec-25.ts","../src/schematron/cen/dec/cen-en16931-br-dec-27.ts","../src/schematron/cen/dec/cen-en16931-br-dec-28.ts","../src/schematron/cen/e/cen-en16931-br-e-01.ts","../src/schematron/cen/e/cen-en16931-br-e-02.ts","../src/schematron/cen/e/cen-en16931-br-e-03.ts","../src/schematron/cen/e/cen-en16931-br-e-04.ts","../src/schematron/cen/e/cen-en16931-br-e-05.ts","../src/schematron/cen/e/cen-en16931-br-e-06.ts","../src/schematron/cen/e/cen-en16931-br-e-07.ts","../src/schematron/cen/e/cen-en16931-br-e-08.ts","../src/schematron/cen/e/cen-en16931-br-e-09.ts","../src/schematron/cen/e/cen-en16931-br-e-10.ts","../src/schematron/cen/g/cen-en16931-br-g-01.ts","../src/schematron/cen/g/cen-en16931-br-g-02.ts","../src/schematron/cen/g/cen-en16931-br-g-03.ts","../src/schematron/cen/g/cen-en16931-br-g-04.ts","../src/schematron/cen/g/cen-en16931-br-g-05.ts","../src/schematron/cen/g/cen-en16931-br-g-06.ts","../src/schematron/cen/g/cen-en16931-br-g-07.ts","../src/schematron/cen/g/cen-en16931-br-g-08.ts","../src/schematron/cen/g/cen-en16931-br-g-09.ts","../src/schematron/cen/g/cen-en16931-br-g-10.ts","../src/schematron/cen/ic/cen-en16931-br-ic-01.ts","../src/schematron/cen/ic/cen-en16931-br-ic-02.ts","../src/schematron/cen/ic/cen-en16931-br-ic-03.ts","../src/schematron/cen/ic/cen-en16931-br-ic-04.ts","../src/schematron/cen/ic/cen-en16931-br-ic-05.ts","../src/schematron/cen/ic/cen-en16931-br-ic-06.ts","../src/schematron/cen/ic/cen-en16931-br-ic-07.ts","../src/schematron/cen/ic/cen-en16931-br-ic-08.ts","../src/schematron/cen/ic/cen-en16931-br-ic-09.ts","../src/schematron/cen/ic/cen-en16931-br-ic-10.ts","../src/schematron/cen/ic/cen-en16931-br-ic-11.ts","../src/schematron/cen/ic/cen-en16931-br-ic-12.ts","../src/schematron/cen/o/cen-en16931-br-o-01.ts","../src/schematron/cen/o/cen-en16931-br-o-02.ts","../src/schematron/cen/o/cen-en16931-br-o-03.ts","../src/schematron/cen/o/cen-en16931-br-o-04.ts","../src/schematron/cen/o/cen-en16931-br-o-05.ts","../src/schematron/cen/o/cen-en16931-br-o-06.ts","../src/schematron/cen/o/cen-en16931-br-o-07.ts","../src/schematron/cen/o/cen-en16931-br-o-08.ts","../src/schematron/cen/o/cen-en16931-br-o-09.ts","../src/schematron/cen/o/cen-en16931-br-o-10.ts","../src/schematron/cen/o/cen-en16931-br-o-11.ts","../src/schematron/cen/o/cen-en16931-br-o-12.ts","../src/schematron/cen/o/cen-en16931-br-o-13.ts","../src/schematron/cen/o/cen-en16931-br-o-14.ts","../src/schematron/cen/s/cen-en16931-br-s-01.ts","../src/schematron/cen/s/cen-en16931-br-s-02.ts","../src/schematron/cen/s/cen-en16931-br-s-03.ts","../src/schematron/cen/s/cen-en16931-br-s-04.ts","../src/schematron/cen/s/cen-en16931-br-s-05.ts","../src/schematron/cen/s/cen-en16931-br-s-06.ts","../src/schematron/cen/s/cen-en16931-br-s-07.ts","../src/schematron/cen/s/cen-en16931-br-s-08.ts","../src/schematron/cen/s/cen-en16931-br-s-09.ts","../src/schematron/cen/s/cen-en16931-br-s-10.ts","../src/schematron/cen/z/cen-en16931-br-z-01.ts","../src/schematron/cen/z/cen-en16931-br-z-02.ts","../src/schematron/cen/z/cen-en16931-br-z-03.ts","../src/schematron/cen/z/cen-en16931-br-z-04.ts","../src/schematron/cen/z/cen-en16931-br-z-05.ts","../src/schematron/cen/z/cen-en16931-br-z-06.ts","../src/schematron/cen/z/cen-en16931-br-z-07.ts","../src/schematron/cen/z/cen-en16931-br-z-08.ts","../src/schematron/cen/z/cen-en16931-br-z-09.ts","../src/schematron/cen/z/cen-en16931-br-z-10.ts","../src/schematron/de/de-r-001.ts","../src/schematron/de/de-r-002.ts","../src/schematron/de/de-r-003.ts","../src/schematron/de/de-r-004.ts","../src/schematron/de/de-r-005.ts","../src/schematron/de/de-r-006.ts","../src/schematron/de/de-r-007.ts","../src/schematron/de/de-r-008.ts","../src/schematron/de/de-r-009.ts","../src/schematron/de/de-r-010.ts","../src/schematron/de/de-r-011.ts","../src/schematron/de/de-r-014.ts","../src/schematron/de/de-r-015.ts","../src/schematron/de/de-r-016.ts","../src/schematron/de/de-r-017.ts","../src/schematron/de/de-r-018.ts","../src/schematron/de/de-r-019.ts","../src/schematron/de/de-r-020.ts","../src/schematron/de/de-r-022.ts","../src/schematron/de/de-r-023-1.ts","../src/schematron/de/de-r-023-2.ts","../src/schematron/de/de-r-024-1.ts","../src/schematron/de/de-r-024-2.ts","../src/schematron/de/de-r-025-1.ts","../src/schematron/de/de-r-025-2.ts","../src/schematron/de/de-r-026.ts","../src/schematron/de/de-r-027.ts","../src/schematron/de/de-r-028.ts","../src/schematron/de/de-r-030.ts","../src/schematron/de/de-r-031.ts","../src/schematron/dk/dk-r-002.ts","../src/schematron/dk/dk-r-003.ts","../src/schematron/dk/dk-r-004.ts","../src/schematron/dk/dk-r-005.ts","../src/schematron/dk/dk-r-006.ts","../src/schematron/dk/dk-r-007.ts","../src/schematron/dk/dk-r-008.ts","../src/schematron/dk/dk-r-009.ts","../src/schematron/dk/dk-r-010.ts","../src/schematron/dk/dk-r-011.ts","../src/schematron/dk/dk-r-013.ts","../src/schematron/dk/dk-r-014.ts","../src/schematron/dk/dk-r-016.ts","../src/schematron/dk/dk-r-017.ts","../src/schematron/gr/gr-r-001-1.ts","../src/schematron/gr/gr-r-001-2.ts","../src/schematron/gr/gr-r-001-3.ts","../src/schematron/gr/gr-r-001-4.ts","../src/schematron/gr/gr-r-001-5.ts","../src/schematron/gr/gr-r-001-6.ts","../src/schematron/gr/gr-r-001-7.ts","../src/schematron/gr/gr-r-002.ts","../src/schematron/gr/gr-r-003.ts","../src/schematron/gr/gr-r-004-1.ts","../src/schematron/gr/gr-r-004-2.ts","../src/schematron/gr/gr-r-005.ts","../src/schematron/gr/gr-r-006.ts","../src/schematron/gr/gr-r-008-2.ts","../src/schematron/gr/gr-r-008-3.ts","../src/schematron/gr/gr-r-009.ts","../src/schematron/gr/gr-r-010.ts","../src/schematron/gr/gr-s-008-1.ts","../src/schematron/gr/gr-s-011.ts","../src/schematron/is/is-r-001.ts","../src/schematron/is/is-r-002.ts","../src/schematron/is/is-r-003.ts","../src/schematron/is/is-r-004.ts","../src/schematron/is/is-r-005.ts","../src/schematron/is/is-r-006.ts","../src/schematron/is/is-r-007.ts","../src/schematron/is/is-r-008.ts","../src/schematron/is/is-r-009.ts","../src/schematron/is/is-r-010.ts","../src/schematron/it/it-r-001.ts","../src/schematron/it/it-r-002.ts","../src/schematron/it/it-r-003.ts","../src/schematron/it/it-r-004.ts","../src/schematron/nl/nl-r-001.ts","../src/schematron/nl/nl-r-002.ts","../src/schematron/nl/nl-r-003.ts","../src/schematron/nl/nl-r-004.ts","../src/schematron/nl/nl-r-005.ts","../src/schematron/nl/nl-r-006.ts","../src/schematron/nl/nl-r-007.ts","../src/schematron/nl/nl-r-008.ts","../src/schematron/nl/nl-r-009.ts","../src/schematron/no/no-r-001.ts","../src/schematron/no/no-r-002.ts","../src/schematron/peppol/cl/peppol-en16931-cl001.ts","../src/schematron/peppol/cl/peppol-en16931-cl002.ts","../src/schematron/peppol/cl/peppol-en16931-cl003.ts","../src/schematron/peppol/cl/peppol-en16931-cl006.ts","../src/schematron/peppol/cl/peppol-en16931-cl007.ts","../src/schematron/peppol/cl/peppol-en16931-cl008.ts","../src/schematron/peppol/common/peppol-common-r040.ts","../src/schematron/peppol/common/peppol-common-r041.ts","../src/schematron/peppol/common/peppol-common-r042.ts","../src/schematron/peppol/common/peppol-common-r043.ts","../src/schematron/peppol/common/peppol-common-r044.ts","../src/schematron/peppol/common/peppol-common-r045.ts","../src/schematron/peppol/common/peppol-common-r046.ts","../src/schematron/peppol/common/peppol-common-r047.ts","../src/schematron/peppol/common/peppol-common-r049.ts","../src/schematron/peppol/common/peppol-common-r050.ts","../src/schematron/peppol/common/peppol-common-r052.ts","../src/schematron/peppol/common/peppol-common-r053.ts","../src/schematron/peppol/f/peppol-en16931-f001.ts","../src/schematron/peppol/p/peppol-en16931-p0100.ts","../src/schematron/peppol/p/peppol-en16931-p0101.ts","../src/schematron/peppol/p/peppol-en16931-p0104.ts","../src/schematron/peppol/p/peppol-en16931-p0105.ts","../src/schematron/peppol/p/peppol-en16931-p0106.ts","../src/schematron/peppol/p/peppol-en16931-p0107.ts","../src/schematron/peppol/p/peppol-en16931-p0108.ts","../src/schematron/peppol/p/peppol-en16931-p0109.ts","../src/schematron/peppol/p/peppol-en16931-p0110.ts","../src/schematron/peppol/p/peppol-en16931-p0111.ts","../src/schematron/peppol/p/peppol-en16931-p0112.ts","../src/schematron/peppol/r/peppol-en16931-r001.ts","../src/schematron/peppol/r/peppol-en16931-r002.ts","../src/schematron/peppol/r/peppol-en16931-r003.ts","../src/schematron/peppol/r/peppol-en16931-r004.ts","../src/schematron/peppol/r/peppol-en16931-r005.ts","../src/schematron/peppol/r/peppol-en16931-r007.ts","../src/schematron/peppol/r/peppol-en16931-r008.ts","../src/schematron/peppol/r/peppol-en16931-r010.ts","../src/schematron/peppol/r/peppol-en16931-r020.ts","../src/schematron/peppol/r/peppol-en16931-r040.ts","../src/schematron/peppol/r/peppol-en16931-r041.ts","../src/schematron/peppol/r/peppol-en16931-r042.ts","../src/schematron/peppol/r/peppol-en16931-r043.ts","../src/schematron/peppol/r/peppol-en16931-r044.ts","../src/schematron/peppol/r/peppol-en16931-r046.ts","../src/schematron/peppol/r/peppol-en16931-r051.ts","../src/schematron/peppol/r/peppol-en16931-r053.ts","../src/schematron/peppol/r/peppol-en16931-r054.ts","../src/schematron/peppol/r/peppol-en16931-r055.ts","../src/schematron/peppol/r/peppol-en16931-r061.ts","../src/schematron/peppol/r/peppol-en16931-r100.ts","../src/schematron/peppol/r/peppol-en16931-r101.ts","../src/schematron/peppol/r/peppol-en16931-r110.ts","../src/schematron/peppol/r/peppol-en16931-r111.ts","../src/schematron/peppol/r/peppol-en16931-r120.ts","../src/schematron/peppol/r/peppol-en16931-r121.ts","../src/schematron/peppol/r/peppol-en16931-r130.ts","../src/schematron/se/se-r-001.ts","../src/schematron/se/se-r-002.ts","../src/schematron/se/se-r-003.ts","../src/schematron/se/se-r-004.ts","../src/schematron/se/se-r-005.ts","../src/schematron/se/se-r-006.ts","../src/schematron/se/se-r-007.ts","../src/schematron/se/se-r-008.ts","../src/schematron/se/se-r-009.ts","../src/schematron/se/se-r-010.ts","../src/schematron/se/se-r-011.ts","../src/schematron/se/se-r-012.ts","../src/schematron/se/se-r-013.ts","../src/schematron/run-all-rules.ts","../src/schematron/schematron.ts"],"sourcesContent":["import { Schema } from 'effect';\n\n/**\n * @description Failure of a single schematron rule against a document.\n */\nexport class SchematronRuleError extends Schema.TaggedError<SchematronRuleError>()('SchematronRuleError', {\n id: Schema.String,\n level: Schema.Literals(['fatal', 'warning']),\n message: Schema.String,\n}) {}\n\n/**\n * @description Failure of a schematron validation run, wrapping every rule that failed.\n */\nexport class SchematronValidationError extends Schema.TaggedError<SchematronValidationError>()('SchematronValidationError', {\n errors: Schema.Array(SchematronRuleError),\n}) {}\n","import { Effect } from 'effect';\n\nimport type { PeppolInvoicePeriod } from '#/schemas/fields/peppol-invoice-period-schema.ts';\nimport type { PeppolTaxSubTotal } from '#/schemas/fields/peppol-tax-subtotal-schema.ts';\nimport type { PeppolDocument, PeppolDocumentLine } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRuleLevel } from '#/schematron/types.ts';\n\nimport { SchematronRuleError } from '#/schematron/errors.ts';\nimport { chargeReasonCodesKeys } from '#/values/charge-reason-codes.generated';\nimport { countryCodesKeys } from '#/values/country-code.generated';\n\nexport type PeppolLine = PeppolDocumentLine;\n\n/**\n * @description Rule metadata shared by all schematron rules.\n */\nexport interface SchematronRule {\n id: string;\n level: SchematronRuleLevel;\n message: string;\n}\n\n/**\n * @description An effectful schematron rule validator. Fails with a `SchematronRuleError` when the document does not satisfy the rule.\n */\nexport type SchematronDocumentValidator = (document: PeppolDocument) => Effect.Effect<void, SchematronRuleError>;\n\n/**\n * @description Builds an effectful validator from rule metadata and a pure predicate.\n */\nexport function schematronRule(rule: SchematronRule, predicate: (document: PeppolDocument) => boolean): SchematronDocumentValidator {\n return Effect.fn(`schematron.${rule.id}`)(function* (document: PeppolDocument) {\n if (!predicate(document)) {\n return yield* new SchematronRuleError({ id: rule.id, level: rule.level, message: rule.message });\n }\n });\n}\n\n/**\n * @description Rounds a number to 2 decimals, mirroring the schematron `round(x * 10 * 10) div 100`.\n */\nexport function round2(value: number): number {\n return Math.round(value * 100) / 100;\n}\n\n/**\n * @description Checks that `val` is within `slack` of `exp`, mirroring the schematron `u:slack` function.\n */\nexport function slack(exp: number, val: number, tolerance: number): boolean {\n return exp + tolerance >= val && exp - tolerance <= val;\n}\n\n/**\n * @description Extracts the process number from the business process identifier, mirroring the schematron `$profile` variable. Returns `'Unknown'` when the\n * identifier does not match the expected format.\n */\nexport function getProfile(document: Pick<PeppolDocument, 'profileId'>): string {\n const profileId = document.profileId;\n if (typeof profileId === 'string' && /^urn:fdc:peppol.eu:2017:poacc:billing:\\d{2}:1\\.0$/.test(profileId.trim())) {\n return profileId.trim().split(':')[6] ?? 'Unknown';\n }\n return 'Unknown';\n}\n\n/**\n * @description Resolves the supplier country from the VAT identifier prefix or the supplier postal address, mirroring the schematron `$supplierCountry` variable.\n */\nexport function getSupplierCountry(document: PeppolDocument): string {\n const vatScheme = document.accountingSupplierParty.partyTaxSchemes?.find(s => s.taxSchemeId.id === 'VAT');\n const prefix = vatScheme?.companyId?.slice(0, 2);\n if (prefix) {\n return prefix.toUpperCase();\n }\n const taxRep = document.taxRepresentativeParty;\n if (taxRep?.partyTaxScheme.taxSchemeId.id === 'VAT') {\n const taxRepPrefix = taxRep.partyTaxScheme.companyId.slice(0, 2);\n if (taxRepPrefix) {\n return taxRepPrefix.toUpperCase();\n }\n }\n const country = document.accountingSupplierParty.postalAddress.countryCode.identificationCode;\n return country ? country.toUpperCase() : 'XX';\n}\n\n/**\n * @description Resolves the customer country from the VAT identifier prefix or the customer postal address, mirroring the schematron `$customerCountry` variable.\n */\nexport function getCustomerCountry(document: PeppolDocument): string {\n const vatScheme = document.accountingCustomerParty.partyTaxSchemes?.find(s => s.taxSchemeId.id === 'VAT');\n const prefix = vatScheme?.companyId?.slice(0, 2);\n if (prefix) {\n return prefix.toUpperCase();\n }\n const country = document.accountingCustomerParty.postalAddress.countryCode.identificationCode;\n return country ? country.toUpperCase() : 'XX';\n}\n\n/**\n * @description Whether the supplier postal address country is Germany, mirroring the schematron `$supplierCountryIsDE` variable.\n */\nexport function isSupplierGermany(document: PeppolDocument): boolean {\n return document.accountingSupplierParty.postalAddress.countryCode.identificationCode.toUpperCase() === 'DE';\n}\n\n/**\n * @description Whether the customer postal address country is Germany, mirroring the schematron `$customerCountryIsDE` variable.\n */\nexport function isCustomerGermany(document: PeppolDocument): boolean {\n return document.accountingCustomerParty.postalAddress.countryCode.identificationCode.toUpperCase() === 'DE';\n}\n\n/**\n * @description Whether both the supplier and customer countries are Denmark, mirroring the schematron `$supplierCountryIsDK` and `$customerCountryIsDK` variables.\n */\nexport function isDanishSupplierAndCustomer(document: PeppolDocument): boolean {\n return getSupplierCountry(document) === 'DK' && getCustomerCountry(document) === 'DK';\n}\n\n/**\n * @description Whether both the supplier and customer postal address countries are Germany, mirroring the schematron `$supplierCountryIsDE` and\n * `$customerCountryIsDE` variables.\n */\nexport function isGermanSupplierAndCustomer(document: PeppolDocument): boolean {\n return isSupplierGermany(document) && isCustomerGermany(document);\n}\n\n/**\n * @description Returns the invoice lines or credit note lines of a document.\n */\nexport function getLines(document: PeppolDocument): Array<PeppolLine> {\n if ('invoiceLines' in document && Array.isArray(document.invoiceLines)) {\n return document.invoiceLines as Array<PeppolLine>;\n }\n if ('creditNoteLines' in document && Array.isArray(document.creditNoteLines)) {\n return document.creditNoteLines as Array<PeppolLine>;\n }\n return [];\n}\n\n/**\n * @description Returns the line quantity (invoiced or credited quantity) of a line, defaulting to 1.\n */\nexport function getLineQuantity(line: PeppolLine): number {\n const quantity = 'invoicedQuantity' in line ? line.invoicedQuantity : 'creditedQuantity' in line ? line.creditedQuantity : undefined;\n return quantity ? quantity.value : 1;\n}\n\n/**\n * @description Returns all document level and line level allowance/charges of a document.\n */\nexport function getAllAllowanceCharges(\n document: PeppolDocument\n): Array<{\n amount: number | undefined;\n allowanceChargeReason: string | undefined;\n baseAmount: number | undefined;\n chargeIndicator: boolean | undefined;\n multiplierFactorNumeric: number | undefined;\n reasonCode: string | undefined;\n taxCategoryId: string | undefined;\n}> {\n const documentLevel = (document.allowanceCharges ?? []).map(ac => ({\n allowanceChargeReason: ac.allowanceChargeReason,\n amount: ac.amount?.value,\n baseAmount: ac.baseAmount?.value,\n chargeIndicator: ac.chargeIndicator,\n multiplierFactorNumeric: ac.multiplierFactorNumeric,\n reasonCode: ac.allowanceChargeReasonCode,\n taxCategoryId: ac.taxCategory?.id,\n }));\n const lineLevel = getLines(document).flatMap(line =>\n (line.allowanceCharges ?? []).map(ac => ({\n allowanceChargeReason: ac.allowanceChargeReason,\n amount: ac.amount?.value,\n baseAmount: ac.baseAmount?.value,\n chargeIndicator: ac.chargeIndicator,\n multiplierFactorNumeric: ac.multiplierFactorNumeric,\n reasonCode: ac.allowanceChargeReasonCode,\n taxCategoryId: undefined,\n }))\n );\n return [...documentLevel, ...lineLevel];\n}\n\n/**\n * @description Whether a VAT breakdown group (BG-23) contains a VAT category code equal to `code`.\n */\nexport function hasVatBreakdownCode(document: PeppolDocument, code: string): boolean {\n return document.taxTotals.some(t => t.taxSubtotals?.some(s => s.taxCategory.id === code) ?? false);\n}\n\n/**\n * @description Whether the document contains a VAT category code (BT-151, BT-95 or BT-102) equal to `code`.\n */\nexport function hasVatCategoryCode(document: PeppolDocument, code: string): boolean {\n const lineCategories = getLines(document).some(line => line.item.classifiedTaxCategory.id === code);\n const allowanceCharges = (document.allowanceCharges ?? []).some(ac => ac.taxCategory?.id === code);\n return lineCategories || allowanceCharges;\n}\n\n/**\n * @description Resolves the supplier VAT identifier (BT-31) or the seller tax registration identifier (BT-32).\n */\nexport function getSupplierTaxIdentifiers(document: PeppolDocument): string {\n const companyIds = document.accountingSupplierParty.partyTaxSchemes?.map(scheme => scheme.companyId) ?? [];\n const taxRepCompanyId = document.taxRepresentativeParty?.partyTaxScheme.companyId;\n return [taxRepCompanyId, ...companyIds].filter((v): v is string => typeof v === 'string' && v.trim() !== '').join(',');\n}\n\n/**\n * @description Whether the supplier has a VAT identifier (BT-31), a seller tax registration identifier (BT-32) or a tax representative VAT identifier (BT-63).\n */\nexport function hasSellerTaxIdentifier(document: PeppolDocument): boolean {\n return document.accountingSupplierParty.partyTaxSchemes?.some(scheme => scheme.companyId.trim() !== '') ?? false;\n}\n\n/**\n * @description Whether the buyer has a VAT identifier (BT-48) or a legal registration identifier (BT-47).\n */\nexport function hasBuyerTaxIdentifier(document: PeppolDocument): boolean {\n const buyerVat = document.accountingCustomerParty.partyTaxSchemes?.some(scheme => scheme.companyId.trim() !== '') ?? false;\n const buyerLegal =\n typeof document.accountingCustomerParty.partyLegalEntity.companyId?.id === 'string' &&\n document.accountingCustomerParty.partyLegalEntity.companyId?.id.trim() !== '';\n return buyerVat || buyerLegal;\n}\n\n/**\n * @description Whether a number has at most two fraction digits, mirroring the schematron `string-length(substring-after(.,'.'))<=2` checks.\n */\nexport function hasMaxTwoDecimals(value: number): boolean {\n return Math.abs(Math.round(value * 100) / 100 - value) < 1e-9;\n}\n\n/**\n * @description Whether two monetary values are equal, tolerating floating point drift of parsed decimals.\n */\nexport function amountsEqual(a: number, b: number): boolean {\n return Math.abs(a - b) < 1e-9;\n}\n\n/**\n * @description Counts the VAT breakdown groups (BG-23) whose VAT category code (BT-118) equals `code`.\n */\nexport function countVatBreakdownCode(document: PeppolDocument, code: string): number {\n return document.taxTotals.reduce(\n (count, total) => count + (total.taxSubtotals?.filter(subtotal => subtotal.taxCategory.id === code).length ?? 0),\n 0\n );\n}\n\n/**\n * @description Counts the occurrences of a VAT category code (BT-151, BT-95 or BT-102) on invoice lines and document level allowance/charges.\n */\nfunction countVatCategoryCode(document: PeppolDocument, code: string): number {\n const lines = getLines(document).filter(line => line.item.classifiedTaxCategory.id === code).length;\n const allowanceCharges = (document.allowanceCharges ?? []).filter(ac => ac.taxCategory?.id === code).length;\n return lines + allowanceCharges;\n}\n\n/**\n * @description Whether an invoice line (BG-25) carries a VAT category code (BT-151) equal to `code`.\n */\nexport function hasLineVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return getLines(document).some(line => line.item.classifiedTaxCategory.id === code);\n}\n\n/**\n * @description Whether a document level allowance (BG-20) carries a VAT category code (BT-95) equal to `code`.\n */\nexport function hasDocumentAllowanceVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return (document.allowanceCharges ?? []).some(ac => !ac.chargeIndicator && ac.taxCategory?.id === code);\n}\n\n/**\n * @description Whether a document level charge (BG-21) carries a VAT category code (BT-102) equal to `code`.\n */\nexport function hasDocumentChargeVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return (document.allowanceCharges ?? []).some(ac => ac.chargeIndicator && ac.taxCategory?.id === code);\n}\n\n/**\n * @description Whether the supplier has a VAT identifier (BT-31) on a party tax scheme whose tax scheme is \"VAT\".\n */\nexport function hasSellerVatCompanyId(document: PeppolDocument): boolean {\n return (\n document.accountingSupplierParty.partyTaxSchemes?.some(\n scheme => scheme.taxSchemeId.id.toUpperCase() === 'VAT' && scheme.companyId.trim() !== ''\n ) ?? false\n );\n}\n\n/**\n * @description Whether the buyer has a VAT identifier (BT-48) on a party tax scheme whose tax scheme is \"VAT\".\n */\nexport function hasBuyerVatCompanyId(document: PeppolDocument): boolean {\n return (\n document.accountingCustomerParty.partyTaxSchemes?.some(\n scheme => scheme.taxSchemeId.id.toUpperCase() === 'VAT' && scheme.companyId.trim() !== ''\n ) ?? false\n );\n}\n\n/**\n * @description Whether the seller tax representative has a VAT identifier (BT-63) on a \"VAT\" tax scheme.\n */\nexport function hasTaxRepresentativeVatCompanyId(document: PeppolDocument): boolean {\n const taxRepresentative = document.taxRepresentativeParty;\n if (!taxRepresentative) {\n return false;\n }\n return taxRepresentative.partyTaxScheme.taxSchemeId.id.toUpperCase() === 'VAT' && taxRepresentative.partyTaxScheme.companyId.trim() !== '';\n}\n\n/**\n * @description Whether the buyer has a legal registration identifier (BT-47).\n */\nexport function hasBuyerLegalCompanyId(document: PeppolDocument): boolean {\n const id = document.accountingCustomerParty.partyLegalEntity.companyId?.id;\n return typeof id === 'string' && id.trim() !== '';\n}\n\n/**\n * @description Whether every invoice line carrying a VAT category code (BT-151) equal to `code` satisfies `predicate` on its VAT rate (BT-152).\n */\nexport function everyLineCategoryPercent(document: PeppolDocument, code: string, predicate: (percent: number | undefined) => boolean): boolean {\n return getLines(document).every(line => line.item.classifiedTaxCategory.id !== code || predicate(line.item.classifiedTaxCategory.percent));\n}\n\n/**\n * @description Whether every document level allowance carrying a VAT category code (BT-95) equal to `code` satisfies `predicate` on its VAT rate (BT-96).\n */\nexport function everyDocumentAllowanceCategoryPercent(\n document: PeppolDocument,\n code: string,\n predicate: (percent: number | undefined) => boolean\n): boolean {\n return (document.allowanceCharges ?? []).every(ac => ac.chargeIndicator || ac.taxCategory?.id !== code || predicate(ac.taxCategory.percent));\n}\n\n/**\n * @description Whether every document level charge carrying a VAT category code (BT-102) equal to `code` satisfies `predicate` on its VAT rate (BT-103).\n */\nexport function everyDocumentChargeCategoryPercent(\n document: PeppolDocument,\n code: string,\n predicate: (percent: number | undefined) => boolean\n): boolean {\n return (document.allowanceCharges ?? []).every(ac => !ac.chargeIndicator || ac.taxCategory?.id !== code || predicate(ac.taxCategory.percent));\n}\n\n/**\n * @description Sum of invoice line net amounts (BT-131) plus document level charge amounts (BT-99) minus document level allowance amounts (BT-92) where the VAT\n * category codes (BT-151, BT-102, BT-95) equal `code`.\n */\nexport function categoryTaxableSum(document: PeppolDocument, code: string): number {\n const lineSum = getLines(document)\n .filter(line => line.item.classifiedTaxCategory.id === code)\n .reduce((sum, line) => sum + line.lineExtensionAmount.value, 0);\n const chargeSum = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator && ac.taxCategory?.id === code)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const allowanceSum = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator && ac.taxCategory?.id === code)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n return lineSum + chargeSum - allowanceSum;\n}\n\n/**\n * @description Returns the VAT breakdown groups (BG-23) whose VAT category code (BT-118) equals `code`.\n */\nexport function getTaxSubtotalsWithCode(\n document: PeppolDocument,\n code: string\n): Array<{\n taxAmount: number;\n taxableAmount: number;\n taxCategory: { id: string; percent: number | undefined; taxExemptionReason: string | undefined; taxExemptionReasonCode: string | undefined };\n}> {\n return document.taxTotals.flatMap(total =>\n (total.taxSubtotals ?? [])\n .filter(subtotal => subtotal.taxCategory.id === code)\n .map(subtotal => ({\n taxAmount: subtotal.taxAmount.value,\n taxableAmount: subtotal.taxableAmount.value,\n taxCategory: {\n id: subtotal.taxCategory.id,\n percent: subtotal.taxCategory.percent,\n taxExemptionReason: subtotal.taxCategory.taxExemptionReason,\n taxExemptionReasonCode: subtotal.taxCategory.taxExemptionReasonCode,\n },\n }))\n );\n}\n\n/**\n * @description Sum of invoice line net amounts (BT-131) plus document level charge amounts (BT-99) minus document level allowance amounts (BT-92) where the VAT\n * category codes (BT-151, BT-102, BT-95) equal `code` and the VAT rates (BT-152, BT-103, BT-96) equal `rate`.\n */\nfunction categoryTaxableSumAtRate(document: PeppolDocument, code: string, rate: number): number {\n const lineSum = getLines(document)\n .filter(line => line.item.classifiedTaxCategory.id === code && line.item.classifiedTaxCategory.percent === rate)\n .reduce((sum, line) => sum + line.lineExtensionAmount.value, 0);\n const chargeSum = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator && ac.taxCategory?.id === code && ac.taxCategory.percent === rate)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const allowanceSum = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator && ac.taxCategory?.id === code && ac.taxCategory.percent === rate)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n return lineSum + chargeSum - allowanceSum;\n}\n\n/**\n * @description Whether the seller has a legal registration identifier (BT-30), used by BR-CO-26.\n */\nexport function hasSellerLegalCompanyId(document: PeppolDocument): boolean {\n const id = document.accountingSupplierParty.partyLegalEntity.companyId?.id;\n return typeof id === 'string' && id.trim() !== '';\n}\n\n/**\n * @description Whether every ISO 3166-1 alpha-2 country code present on the document equals `code`, used by BR-B-01.\n */\nexport function everyCountryCodeIs(document: PeppolDocument, code: string): boolean {\n const codes = [\n document.accountingSupplierParty.postalAddress.countryCode.identificationCode,\n document.accountingCustomerParty.postalAddress.countryCode.identificationCode,\n document.taxRepresentativeParty?.postalAddress.countryCode.identificationCode,\n document.delivery?.deliveryLocation?.address?.countryCode.identificationCode,\n ...getLines(document)\n .map(line => line.item.originCountryCode?.identificationCode)\n .filter((v): v is string => typeof v === 'string'),\n ].filter((v): v is string => typeof v === 'string' && v.trim() !== '');\n return codes.every(value => value.toUpperCase() === code);\n}\n\n/**\n * @description Whether every VAT identifier (BT-31, BT-63, BT-48) carries a country prefix from the ISO 3166-1 alpha-2 list (including EL), used by BR-CO-09.\n */\nexport function allVatCompanyIdsHaveValidPrefix(document: PeppolDocument): boolean {\n const companyIds: Array<string> = [];\n const pushVatIds = (schemes: Array<{ companyId: string; taxSchemeId: { id: string } }> | undefined) => {\n for (const scheme of schemes ?? []) {\n if (scheme.taxSchemeId.id.toUpperCase() === 'VAT' && scheme.companyId.trim() !== '') {\n companyIds.push(scheme.companyId.trim());\n }\n }\n };\n pushVatIds(document.accountingSupplierParty.partyTaxSchemes);\n pushVatIds(document.accountingCustomerParty.partyTaxSchemes);\n if (\n document.taxRepresentativeParty?.partyTaxScheme.taxSchemeId.id.toUpperCase() === 'VAT' &&\n document.taxRepresentativeParty.partyTaxScheme.companyId.trim() !== ''\n ) {\n companyIds.push(document.taxRepresentativeParty.partyTaxScheme.companyId.trim());\n }\n return companyIds.every(id => (countryCodesKeys as ReadonlyArray<string>).includes(id.slice(0, 2)));\n}\n\n/**\n * @description Whether every invoice period / line period has an end date after or equal to its start date, used by BR-29 and BR-30.\n */\nexport function everyPeriodEndAfterStart(document: PeppolDocument): boolean {\n const ok = (period: PeppolInvoicePeriod | undefined): boolean => {\n if (!period?.startDate || !period.endDate) {\n return true;\n }\n return period.endDate >= period.startDate;\n };\n const lineOk = getLines(document).every(line => ok(line.invoicePeriod));\n return ok(document.invoicePeriod) && lineOk;\n}\n\n/**\n * @description Whether every invoice period has a start/end date or a description code, used by BR-CO-19 and BR-CO-20.\n */\nexport function everyPeriodHasDateOrDescriptionCode(document: PeppolDocument): boolean {\n const ok = (period: PeppolInvoicePeriod | undefined): boolean => {\n if (!period) {\n return true;\n }\n return typeof period.startDate === 'string' || typeof period.endDate === 'string' || typeof period.descriptionCode === 'string';\n };\n const lineOk = getLines(document).every(line => ok(line.invoicePeriod));\n return ok(document.invoicePeriod) && lineOk;\n}\n\n/**\n * @description Whether the note subject code, when present, is coded using UNTDID 4451, used by BR-CL-08.\n */\nexport function noteSubjectCodeIsUncl4451(document: PeppolDocument): boolean {\n const note = document.note;\n if (typeof note !== 'string' || !note.includes('#')) {\n return true;\n }\n const subject = note.split('#')[1] ?? '';\n if (subject.length !== 3) {\n return true;\n }\n return (chargeReasonCodesKeys as ReadonlyArray<string>).includes(subject);\n}\n\n/**\n * @description Total number of VAT breakdown groups (BG-23) present on the document.\n */\nexport function countAllVatBreakdowns(document: PeppolDocument): number {\n return document.taxTotals.reduce((count, total) => count + (total.taxSubtotals?.length ?? 0), 0);\n}\n\n/**\n * @description Whether the document contains a VAT category code (BT-151, BT-95, BT-102) or a VAT breakdown category code (BT-118) equal to `code`.\n */\nexport function hasAnyVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return countVatCategoryCode(document, code) > 0 || countVatBreakdownCode(document, code) > 0;\n}\n\n/**\n * @description Whether `a` and `b` are within 1 of each other, mirroring the schematron slack used by BR-S-08, BR-AF-08 and BR-AG-08.\n */\nexport function withinSlackOne(a: number, b: number): boolean {\n return Math.abs(a - b) < 1;\n}\n\n/**\n * @description Whether the VAT category tax amount (BT-117) equals the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119), allowing\n * for a slack of 1, mirroring BR-CO-17.\n */\nexport function vatCategoryTaxAmountMatchesRate(subtotal: PeppolTaxSubTotal): boolean {\n const percent = subtotal.taxCategory.percent;\n if (percent === undefined) {\n return Math.round(subtotal.taxAmount.value) === 0;\n }\n if (Math.round(percent) === 0) {\n return Math.round(subtotal.taxAmount.value) === 0;\n }\n const expected = round2(Math.abs(subtotal.taxableAmount.value) * (percent / 100));\n const actual = Math.abs(subtotal.taxAmount.value);\n return withinSlackOne(actual, expected);\n}\n\n/**\n * @description Whether every VAT breakdown (BG-23) whose VAT category code (BT-118) is \"Standard rated\", \"IGIC\" or \"IPSI\" has a VAT category taxable amount\n * (BT-116) that equals the sum of invoice line net amounts (BT-131) plus document level charge amounts (BT-99) minus document level allowance amounts\n * (BT-92) at the same VAT rate, allowing a slack of 1, mirroring BR-S-08, BR-AF-08 and BR-AG-08.\n */\nexport function everyVatBreakdownTaxableMatchesRateSum(document: PeppolDocument): boolean {\n for (const total of document.taxTotals) {\n for (const subtotal of total.taxSubtotals ?? []) {\n const code = subtotal.taxCategory.id;\n if (code !== 'S' && code !== 'L' && code !== 'M') {\n continue;\n }\n const rate = subtotal.taxCategory.percent;\n if (rate === undefined) {\n return false;\n }\n if (!withinSlackOne(subtotal.taxableAmount.value, categoryTaxableSumAtRate(document, code, rate))) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @description Returns all identifiers carrying a scheme identifier, used by the PEPPOL-COMMON-R* rules.\n */\nexport function getIdentifiersWithSchemeId(document: PeppolDocument): Array<{ id: string; schemeId: string }> {\n const candidates: Array<{ id: string | undefined; schemeId: string | undefined }> = [];\n for (const party of [document.accountingSupplierParty, document.accountingCustomerParty]) {\n candidates.push(\n { id: party.endpointId?.id, schemeId: party.endpointId?.schemeId },\n { id: party.partyIdentification?.id?.id, schemeId: party.partyIdentification?.id?.schemeId },\n { id: party.partyLegalEntity.companyId?.id, schemeId: party.partyLegalEntity.companyId?.schemeId }\n );\n }\n const payeeIdentification = document.payeeParty?.partyIdentification?.id;\n if (payeeIdentification) {\n candidates.push({ id: payeeIdentification.id, schemeId: payeeIdentification.schemeId });\n }\n return candidates.filter((candidate): candidate is { id: string; schemeId: string } => Boolean(candidate.id) && Boolean(candidate.schemeId));\n}\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Reverse charge\" shall contain in the VAT Breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"VAT reverse charge\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'AE') || countVatBreakdownCode(document, 'AE') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrAe01 = schematronRule(rule, evaluateCenEn16931BrAe01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerLegalCompanyId,\n hasBuyerVatCompanyId,\n hasLineVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Reverse charge\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) and/or the Buyer legal registration identifier (BT-47).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe02(document: PeppolDocument): boolean {\n const passed =\n !hasLineVatCategoryCode(document, 'AE') ||\n ((hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document)) &&\n (hasBuyerVatCompanyId(document) || hasBuyerLegalCompanyId(document)));\n return passed;\n}\n\nexport const validateCenEn16931BrAe02 = schematronRule(rule, evaluateCenEn16931BrAe02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerLegalCompanyId,\n hasBuyerVatCompanyId,\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Reverse charge\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) and/or the Buyer legal registration identifier (BT-47).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'AE') ||\n ((hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document)) &&\n (hasBuyerVatCompanyId(document) || hasBuyerLegalCompanyId(document)));\n return passed;\n}\n\nexport const validateCenEn16931BrAe03 = schematronRule(rule, evaluateCenEn16931BrAe03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerLegalCompanyId,\n hasBuyerVatCompanyId,\n hasDocumentChargeVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Reverse charge\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) and/or the Buyer legal registration identifier (BT-47).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe04(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentChargeVatCategoryCode(document, 'AE') ||\n ((hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document)) &&\n (hasBuyerVatCompanyId(document) || hasBuyerLegalCompanyId(document)));\n return passed;\n}\n\nexport const validateCenEn16931BrAe04 = schematronRule(rule, evaluateCenEn16931BrAe04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Reverse charge\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'AE', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe05 = schematronRule(rule, evaluateCenEn16931BrAe05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Reverse charge\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'AE', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe06 = schematronRule(rule, evaluateCenEn16931BrAe06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Reverse charge\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'AE', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe07 = schematronRule(rule, evaluateCenEn16931BrAe07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Reverse charge\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Reverse charge\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'AE').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'AE')));\n return passed;\n}\n\nexport const validateCenEn16931BrAe08 = schematronRule(rule, evaluateCenEn16931BrAe08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Reverse charge\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'AE').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe09 = schematronRule(rule, evaluateCenEn16931BrAe09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Reverse charge\" shall have a VAT exemption reason code (BT-121), meaning \"Reverse charge\" or the VAT exemption reason text (BT-120) \"Reverse charge\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'AE').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAe10 = schematronRule(rule, evaluateCenEn16931BrAe10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IGIC\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IGIC\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'L') || countVatBreakdownCode(document, 'L') > 0;\n return passed;\n}\n\nexport const validateCenEn16931BrAf01 = schematronRule(rule, evaluateCenEn16931BrAf01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'L') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf02 = schematronRule(rule, evaluateCenEn16931BrAf02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'L') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf03 = schematronRule(rule, evaluateCenEn16931BrAf03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'L') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf04 = schematronRule(rule, evaluateCenEn16931BrAf04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" the invoiced item VAT rate (BT-152) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'L', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAf05 = schematronRule(rule, evaluateCenEn16931BrAf05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'L', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAf06 = schematronRule(rule, evaluateCenEn16931BrAf06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'L', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAf07 = schematronRule(rule, evaluateCenEn16931BrAf07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyVatBreakdownTaxableMatchesRateSum, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-08',\n level: 'fatal',\n message:\n 'For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IGIC\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IGIC\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf08(document: PeppolDocument): boolean {\n const passed = everyVatBreakdownTaxableMatchesRateSum(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf08 = schematronRule(rule, evaluateCenEn16931BrAf08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, round2, schematronRule, withinSlackOne } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IGIC\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'L').every(st =>\n withinSlackOne(st.taxAmount, round2((st.taxableAmount * (st.taxCategory.percent ?? 0)) / 100))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAf09 = schematronRule(rule, evaluateCenEn16931BrAf09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"IGIC\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'L').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAf10 = schematronRule(rule, evaluateCenEn16931BrAf10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IPSI\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IPSI\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'M') || countVatBreakdownCode(document, 'M') > 0;\n return passed;\n}\n\nexport const validateCenEn16931BrAg01 = schematronRule(rule, evaluateCenEn16931BrAg01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'M') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg02 = schematronRule(rule, evaluateCenEn16931BrAg02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'M') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg03 = schematronRule(rule, evaluateCenEn16931BrAg03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'M') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg04 = schematronRule(rule, evaluateCenEn16931BrAg04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" the Invoiced item VAT rate (BT-152) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'M', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAg05 = schematronRule(rule, evaluateCenEn16931BrAg05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'M', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAg06 = schematronRule(rule, evaluateCenEn16931BrAg06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'M', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAg07 = schematronRule(rule, evaluateCenEn16931BrAg07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyVatBreakdownTaxableMatchesRateSum, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-08',\n level: 'fatal',\n message:\n 'For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IPSI\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IPSI\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg08(document: PeppolDocument): boolean {\n const passed = everyVatBreakdownTaxableMatchesRateSum(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg08 = schematronRule(rule, evaluateCenEn16931BrAg08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, round2, schematronRule, withinSlackOne } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IPSI\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'M').every(st =>\n withinSlackOne(st.taxAmount, round2((st.taxableAmount * (st.taxCategory.percent ?? 0)) / 100))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAg09 = schematronRule(rule, evaluateCenEn16931BrAg09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"IPSI\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'M').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAg10 = schematronRule(rule, evaluateCenEn16931BrAg10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyCountryCodeIs, hasVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-B-01',\n level: 'fatal',\n message: 'An Invoice where the VAT category code (BT-151, BT-95 or BT-102) is “Split payment” shall be a domestic Italian invoice.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrB01(document: PeppolDocument): boolean {\n const passed = !hasVatCategoryCode(document, 'B') || everyCountryCodeIs(document, 'IT');\n return passed;\n}\n\nexport const validateCenEn16931BrB01 = schematronRule(rule, evaluateCenEn16931BrB01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-B-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is “Split payment\" shall not contain an invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is “Standard rated”.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrB02(document: PeppolDocument): boolean {\n const passed = !hasVatCategoryCode(document, 'B') || !hasVatCategoryCode(document, 'S');\n return passed;\n}\n\nexport const validateCenEn16931BrB02 = schematronRule(rule, evaluateCenEn16931BrB02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-01',\n level: 'fatal',\n message: 'An Invoice shall have a Specification identifier (BT-24).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br01(document: PeppolDocument): boolean {\n const passed = typeof document.customizationId === 'string' && document.customizationId.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br01 = schematronRule(rule, evaluateCenEn16931Br01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-02',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice number (BT-1).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br02(document: PeppolDocument): boolean {\n const passed = typeof document.id === 'string' && document.id.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br02 = schematronRule(rule, evaluateCenEn16931Br02);\n","import { Predicate } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-03',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice issue date (BT-2).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br03(document: PeppolDocument): boolean {\n const passed = Predicate.hasProperty(document, 'issueDate') && Predicate.isTruthy(document.issueDate);\n return passed;\n}\n\nexport const validateCenEn16931Br03 = schematronRule(rule, evaluateCenEn16931Br03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-04',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice type code (BT-3).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br04(document: PeppolDocument): boolean {\n const passed =\n (typeof document.invoiceTypeCode === 'string' && document.invoiceTypeCode.trim() !== '') ||\n (typeof document.creditNoteTypeCode === 'string' && document.creditNoteTypeCode.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br04 = schematronRule(rule, evaluateCenEn16931Br04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-05',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice currency code (BT-5).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br05(document: PeppolDocument): boolean {\n const passed = typeof document.documentCurrencyCode === 'string' && document.documentCurrencyCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br05 = schematronRule(rule, evaluateCenEn16931Br05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-06',\n level: 'fatal',\n message: 'An Invoice shall contain the Seller name (BT-27).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br06(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingSupplierParty.partyLegalEntity.registrationName === 'string' &&\n document.accountingSupplierParty.partyLegalEntity.registrationName.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br06 = schematronRule(rule, evaluateCenEn16931Br06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-07',\n level: 'fatal',\n message: 'An Invoice shall contain the Buyer name (BT-44).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br07(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingCustomerParty.partyLegalEntity.registrationName === 'string' &&\n document.accountingCustomerParty.partyLegalEntity.registrationName.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br07 = schematronRule(rule, evaluateCenEn16931Br07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-08',\n level: 'fatal',\n message: 'An Invoice shall contain the Seller postal address.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br08(document: PeppolDocument): boolean {\n const passed = typeof document.accountingSupplierParty.postalAddress === 'object' && document.accountingSupplierParty.postalAddress !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br08 = schematronRule(rule, evaluateCenEn16931Br08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-09',\n level: 'fatal',\n message: 'The Seller postal address (BG-5) shall contain a Seller country code (BT-40).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br09(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingSupplierParty.postalAddress.countryCode.identificationCode === 'string' &&\n document.accountingSupplierParty.postalAddress.countryCode.identificationCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br09 = schematronRule(rule, evaluateCenEn16931Br09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-10',\n level: 'fatal',\n message: 'An Invoice shall contain the Buyer postal address (BG-8).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br10(document: PeppolDocument): boolean {\n const passed = typeof document.accountingCustomerParty.postalAddress === 'object' && document.accountingCustomerParty.postalAddress !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br10 = schematronRule(rule, evaluateCenEn16931Br10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-11',\n level: 'fatal',\n message: 'The Buyer postal address shall contain a Buyer country code (BT-55).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br11(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingCustomerParty.postalAddress.countryCode.identificationCode === 'string' &&\n document.accountingCustomerParty.postalAddress.countryCode.identificationCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br11 = schematronRule(rule, evaluateCenEn16931Br11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-12',\n level: 'fatal',\n message: 'An Invoice shall have the Sum of Invoice line net amount (BT-106).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br12(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.lineExtensionAmount === 'object' && document.legalMonetaryTotal.lineExtensionAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br12 = schematronRule(rule, evaluateCenEn16931Br12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-13',\n level: 'fatal',\n message: 'An Invoice shall have the Invoice total amount without VAT (BT-109).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br13(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.taxExclusiveAmount === 'object' && document.legalMonetaryTotal.taxExclusiveAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br13 = schematronRule(rule, evaluateCenEn16931Br13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-14',\n level: 'fatal',\n message: 'An Invoice shall have the Invoice total amount with VAT (BT-112).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br14(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.taxInclusiveAmount === 'object' && document.legalMonetaryTotal.taxInclusiveAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br14 = schematronRule(rule, evaluateCenEn16931Br14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-15',\n level: 'fatal',\n message: 'An Invoice shall have the Amount due for payment (BT-115).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br15(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.payableAmount === 'object' && document.legalMonetaryTotal.payableAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br15 = schematronRule(rule, evaluateCenEn16931Br15);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-16',\n level: 'fatal',\n message: 'An Invoice shall have at least one Invoice line (BG-25)',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br16(document: PeppolDocument): boolean {\n const passed = getLines(document).length > 0;\n return passed;\n}\n\nexport const validateCenEn16931Br16 = schematronRule(rule, evaluateCenEn16931Br16);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-17',\n level: 'fatal',\n message: 'The Payee name (BT-59) shall be provided in the Invoice, if the Payee (BG-10) is different from the Seller (BG-4)',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br17(document: PeppolDocument): boolean {\n const passed =\n !document.payeeParty ||\n (typeof document.payeeParty.partyName.name === 'string' &&\n document.payeeParty.partyName.name.trim() !== '' &&\n document.payeeParty.partyName.name !== document.accountingSupplierParty.partyLegalEntity.registrationName &&\n (document.payeeParty.partyIdentification?.id?.id === undefined ||\n document.payeeParty.partyIdentification.id.id !== document.accountingSupplierParty.partyIdentification?.id?.id));\n return passed;\n}\n\nexport const validateCenEn16931Br17 = schematronRule(rule, evaluateCenEn16931Br17);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-18',\n level: 'fatal',\n message:\n 'The Seller tax representative name (BT-62) shall be provided in the Invoice, if the Seller (BG-4) has a Seller tax representative party (BG-11)',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br18(document: PeppolDocument): boolean {\n const passed =\n !document.taxRepresentativeParty ||\n (typeof document.taxRepresentativeParty.name === 'string' && document.taxRepresentativeParty.name.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br18 = schematronRule(rule, evaluateCenEn16931Br18);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-19',\n level: 'fatal',\n message:\n 'The Seller tax representative postal address (BG-12) shall be provided in the Invoice, if the Seller (BG-4) has a Seller tax representative party (BG-11).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br19(document: PeppolDocument): boolean {\n const passed =\n !document.taxRepresentativeParty ||\n (typeof document.taxRepresentativeParty.postalAddress === 'object' && document.taxRepresentativeParty.postalAddress !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br19 = schematronRule(rule, evaluateCenEn16931Br19);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-20',\n level: 'fatal',\n message:\n 'The Seller tax representative postal address (BG-12) shall contain a Tax representative country code (BT-69), if the Seller (BG-4) has a Seller tax representative party (BG-11).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br20(document: PeppolDocument): boolean {\n const passed =\n !document.taxRepresentativeParty ||\n (typeof document.taxRepresentativeParty.postalAddress.countryCode.identificationCode === 'string' &&\n document.taxRepresentativeParty.postalAddress.countryCode.identificationCode.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br20 = schematronRule(rule, evaluateCenEn16931Br20);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-21',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall have an Invoice line identifier (BT-126).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br21(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.id === 'string' && line.id.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br21 = schematronRule(rule, evaluateCenEn16931Br21);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-22',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall have an Invoiced quantity (BT-129).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br22(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => ('invoicedQuantity' in line ? line.invoicedQuantity : line.creditedQuantity) !== undefined);\n return passed;\n}\n\nexport const validateCenEn16931Br22 = schematronRule(rule, evaluateCenEn16931Br22);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-23',\n level: 'fatal',\n message: 'An Invoice line (BG-25) shall have an Invoiced quantity unit of measure code (BT-130).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br23(document: PeppolDocument): boolean {\n const passed = getLines(document).every(\n line => ('invoicedQuantity' in line ? line.invoicedQuantity : line.creditedQuantity)?.unitCode !== undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931Br23 = schematronRule(rule, evaluateCenEn16931Br23);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-24',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall have an Invoice line net amount (BT-131).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br24(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.lineExtensionAmount === 'object' && line.lineExtensionAmount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br24 = schematronRule(rule, evaluateCenEn16931Br24);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-25',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall contain the Item name (BT-153).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br25(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.item.name === 'string' && line.item.name.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br25 = schematronRule(rule, evaluateCenEn16931Br25);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-26',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall contain the Item net price (BT-146).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br26(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.price.priceAmount === 'object' && line.price.priceAmount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br26 = schematronRule(rule, evaluateCenEn16931Br26);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-27',\n level: 'fatal',\n message: 'The Item net price (BT-146) shall NOT be negative.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br27(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => line.price.priceAmount.value >= 0);\n return passed;\n}\n\nexport const validateCenEn16931Br27 = schematronRule(rule, evaluateCenEn16931Br27);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-28',\n level: 'fatal',\n message: 'The Item gross price (BT-148) shall NOT be negative.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br28(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => !line.price.allowanceCharge?.baseAmount || line.price.allowanceCharge.baseAmount.value >= 0);\n return passed;\n}\n\nexport const validateCenEn16931Br28 = schematronRule(rule, evaluateCenEn16931Br28);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodEndAfterStart, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-29',\n level: 'fatal',\n message:\n 'If both Invoicing period start date (BT-73) and Invoicing period end date (BT-74) are given then the Invoicing period end date (BT-74) shall be later or equal to the Invoicing period start date (BT-73).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br29(document: PeppolDocument): boolean {\n const passed = everyPeriodEndAfterStart(document);\n return passed;\n}\n\nexport const validateCenEn16931Br29 = schematronRule(rule, evaluateCenEn16931Br29);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodEndAfterStart, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-30',\n level: 'fatal',\n message:\n 'If both Invoice line period start date (BT-134) and Invoice line period end date (BT-135) are given then the Invoice line period end date (BT-135) shall be later or equal to the Invoice line period start date (BT-134).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br30(document: PeppolDocument): boolean {\n const passed = everyPeriodEndAfterStart(document);\n return passed;\n}\n\nexport const validateCenEn16931Br30 = schematronRule(rule, evaluateCenEn16931Br30);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-31',\n level: 'fatal',\n message: 'Each Document level allowance (BG-20) shall have a Document level allowance amount (BT-92).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br31(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br31 = schematronRule(rule, evaluateCenEn16931Br31);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-32',\n level: 'fatal',\n message: 'Each Document level allowance (BG-20) shall have a Document level allowance VAT category code (BT-95).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br32(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.taxCategory?.id === 'string' && ac.taxCategory.taxSchemeId.id.toUpperCase() === 'VAT');\n return passed;\n}\n\nexport const validateCenEn16931Br32 = schematronRule(rule, evaluateCenEn16931Br32);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-33',\n level: 'fatal',\n message:\n 'Each Document level allowance (BG-20) shall have a Document level allowance reason (BT-97) or a Document level allowance reason code (BT-98).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br33(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931Br33 = schematronRule(rule, evaluateCenEn16931Br33);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-36',\n level: 'fatal',\n message: 'Each Document level charge (BG-21) shall have a Document level charge amount (BT-99).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br36(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br36 = schematronRule(rule, evaluateCenEn16931Br36);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-37',\n level: 'fatal',\n message: 'Each Document level charge (BG-21) shall have a Document level charge VAT category code (BT-102).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br37(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.taxCategory?.id === 'string' && ac.taxCategory.taxSchemeId.id.toUpperCase() === 'VAT');\n return passed;\n}\n\nexport const validateCenEn16931Br37 = schematronRule(rule, evaluateCenEn16931Br37);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-38',\n level: 'fatal',\n message: 'Each Document level charge (BG-21) shall have a Document level charge reason (BT-104) or a Document level charge reason code (BT-105).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br38(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931Br38 = schematronRule(rule, evaluateCenEn16931Br38);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-41',\n level: 'fatal',\n message: 'Each Invoice line allowance (BG-27) shall have an Invoice line allowance amount (BT-136).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br41(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null)\n );\n return passed;\n}\n\nexport const validateCenEn16931Br41 = schematronRule(rule, evaluateCenEn16931Br41);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-42',\n level: 'fatal',\n message:\n 'Each Invoice line allowance (BG-27) shall have an Invoice line allowance reason (BT-139) or an Invoice line allowance reason code (BT-140).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br42(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br42 = schematronRule(rule, evaluateCenEn16931Br42);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-43',\n level: 'fatal',\n message: 'Each Invoice line charge (BG-28) shall have an Invoice line charge amount (BT-141).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br43(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null)\n );\n return passed;\n}\n\nexport const validateCenEn16931Br43 = schematronRule(rule, evaluateCenEn16931Br43);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-44',\n level: 'fatal',\n message: 'Each Invoice line charge shall have an Invoice line charge reason or an invoice line allowance reason code.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br44(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br44 = schematronRule(rule, evaluateCenEn16931Br44);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-45',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall have a VAT category taxable amount (BT-116).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br45(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(st => typeof st.taxableAmount === 'object' && st.taxableAmount !== null)\n );\n return passed;\n}\n\nexport const validateCenEn16931Br45 = schematronRule(rule, evaluateCenEn16931Br45);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-46',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall have a VAT category tax amount (BT-117).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br46(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => typeof st.taxAmount === 'object' && st.taxAmount !== null));\n return passed;\n}\n\nexport const validateCenEn16931Br46 = schematronRule(rule, evaluateCenEn16931Br46);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-47',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall be defined through a VAT category code (BT-118).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br47(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(st => typeof st.taxCategory?.id === 'string' && st.taxCategory.taxSchemeId.id.toUpperCase() === 'VAT')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br47 = schematronRule(rule, evaluateCenEn16931Br47);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-48',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall have a VAT category rate (BT-119), except if the Invoice is not subject to VAT.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br48(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(st => typeof st.taxCategory.percent === 'number' || st.taxCategory.id === 'O')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br48 = schematronRule(rule, evaluateCenEn16931Br48);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-49',\n level: 'fatal',\n message: 'A Payment instruction (BG-16) shall specify the Payment means type code (BT-81).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br49(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(pm => typeof pm.paymentMeansCode?.code === 'string' && pm.paymentMeansCode.code.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br49 = schematronRule(rule, evaluateCenEn16931Br49);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-50',\n level: 'fatal',\n message: 'A Payment account identifier (BT-84) shall be present if Credit transfer (BG-17) information is provided in the Invoice.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br50(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(\n pm =>\n (pm.paymentMeansCode?.code !== '30' && pm.paymentMeansCode?.code !== '58') ||\n (typeof pm.payeeFinancialAccount?.id === 'string' && pm.payeeFinancialAccount.id.trim() !== '')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br50 = schematronRule(rule, evaluateCenEn16931Br50);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-51',\n level: 'warning',\n message:\n 'In accordance with card payments security standards an invoice should never include a full card primary account number (BT-87). At the moment PCI Security Standards Council has defined that the first 6 digits and last 4 digits are the maximum number of digits to be shown.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br51(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(pm => !pm.cardAccount || pm.cardAccount.primaryAccountNumberId.trim().length <= 10);\n return passed;\n}\n\nexport const validateCenEn16931Br51 = schematronRule(rule, evaluateCenEn16931Br51);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-52',\n level: 'fatal',\n message: 'Each Additional supporting document (BG-24) shall contain a Supporting document reference (BT-122).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br52(document: PeppolDocument): boolean {\n const passed = (document.additionalDocumentReferences ?? []).every(ref => typeof ref.id?.id === 'string' && ref.id.id.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br52 = schematronRule(rule, evaluateCenEn16931Br52);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-53',\n level: 'fatal',\n message:\n 'If the VAT accounting currency code (BT-6) is present, then the Invoice total VAT amount in accounting currency (BT-111) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br53(document: PeppolDocument): boolean {\n const passed = !document.taxCurrencyCode || document.taxTotals.some(total => total.taxAmount.currencyId === document.taxCurrencyCode);\n return passed;\n}\n\nexport const validateCenEn16931Br53 = schematronRule(rule, evaluateCenEn16931Br53);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-54',\n level: 'fatal',\n message: 'Each Item attribute (BG-32) shall contain an Item attribute name (BT-160) and an Item attribute value (BT-161).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br54(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.item.additionalItemProperties ?? []).every(\n prop => typeof prop.name === 'string' && prop.name.trim() !== '' && typeof prop.value === 'string' && prop.value.trim() !== ''\n )\n );\n return passed;\n}\n\nexport const validateCenEn16931Br54 = schematronRule(rule, evaluateCenEn16931Br54);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-55',\n level: 'fatal',\n message: 'Each Preceding Invoice reference (BG-3) shall contain a Preceding Invoice reference (BT-25).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br55(document: PeppolDocument): boolean {\n const passed = (document.billingReferences ?? []).every(\n ref => typeof ref.invoiceDocumentReference.id === 'string' && ref.invoiceDocumentReference.id.trim() !== ''\n );\n return passed;\n}\n\nexport const validateCenEn16931Br55 = schematronRule(rule, evaluateCenEn16931Br55);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-56',\n level: 'fatal',\n message: 'Each Seller tax representative party (BG-11) shall have a Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br56(document: PeppolDocument): boolean {\n const passed = !document.taxRepresentativeParty || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931Br56 = schematronRule(rule, evaluateCenEn16931Br56);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-57',\n level: 'fatal',\n message: 'Each Deliver to address (BG-15) shall contain a Deliver to country code (BT-80).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br57(document: PeppolDocument): boolean {\n const passed =\n typeof document.delivery?.deliveryLocation?.address?.countryCode.identificationCode === 'string' &&\n document.delivery.deliveryLocation.address.countryCode.identificationCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br57 = schematronRule(rule, evaluateCenEn16931Br57);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-61',\n level: 'fatal',\n message:\n 'If the Payment means type code (BT-81) means SEPA credit transfer, Local credit transfer or Non-SEPA international credit transfer, the Payment account identifier (BT-84) shall be present.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br61(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(\n pm =>\n (pm.paymentMeansCode?.code !== '30' && pm.paymentMeansCode?.code !== '58') ||\n (typeof pm.payeeFinancialAccount?.id === 'string' && pm.payeeFinancialAccount.id.trim() !== '')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br61 = schematronRule(rule, evaluateCenEn16931Br61);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-62',\n level: 'fatal',\n message: 'The Seller electronic address (BT-34) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br62(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingSupplierParty.endpointId?.schemeId === 'string' && document.accountingSupplierParty.endpointId.schemeId.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br62 = schematronRule(rule, evaluateCenEn16931Br62);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-63',\n level: 'fatal',\n message: 'The Buyer electronic address (BT-49) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br63(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingCustomerParty.endpointId?.schemeId === 'string' && document.accountingCustomerParty.endpointId.schemeId.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br63 = schematronRule(rule, evaluateCenEn16931Br63);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-64',\n level: 'fatal',\n message: 'The Item standard identifier (BT-157) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br64(document: PeppolDocument): boolean {\n const passed = getLines(document).every(\n line => !line.item.standardItemIdentification || typeof line.item.standardItemIdentification.id.schemeId === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931Br64 = schematronRule(rule, evaluateCenEn16931Br64);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-65',\n level: 'fatal',\n message: 'The Item classification identifier (BT-158) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br65(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.item.commodityClassifications ?? []).every(cc => typeof cc.itemClassification.listId === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br65 = schematronRule(rule, evaluateCenEn16931Br65);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { noteSubjectCodeIsUncl4451, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CL-08',\n level: 'fatal',\n message: 'Invoiced note subject code shall be coded using UNCL4451',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCl08(document: PeppolDocument): boolean {\n const passed = noteSubjectCodeIsUncl4451(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCl08 = schematronRule(rule, evaluateCenEn16931BrCl08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-03',\n level: 'fatal',\n message: 'Value added tax point date (BT-7) and Value added tax point date code (BT-8) are mutually exclusive.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo03(document: PeppolDocument): boolean {\n const passed = !document.taxPointDate || !document.invoicePeriod?.descriptionCode;\n return passed;\n}\n\nexport const validateCenEn16931BrCo03 = schematronRule(rule, evaluateCenEn16931BrCo03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-04',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall be categorized with an Invoiced item VAT category code (BT-151).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo04(document: PeppolDocument): boolean {\n const passed = getLines(document).every(\n line => typeof line.item.classifiedTaxCategory?.id === 'string' && line.item.classifiedTaxCategory.taxSchemeId.id.toUpperCase() === 'VAT'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo04 = schematronRule(rule, evaluateCenEn16931BrCo04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-05',\n level: 'fatal',\n message: 'Document level allowance reason code (BT-98) and Document level allowance reason (BT-97) shall indicate the same type of allowance.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo05(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo05 = schematronRule(rule, evaluateCenEn16931BrCo05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-06',\n level: 'fatal',\n message: 'Document level charge reason code (BT-105) and Document level charge reason (BT-104) shall indicate the same type of charge.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo06(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo06 = schematronRule(rule, evaluateCenEn16931BrCo06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-07',\n level: 'fatal',\n message: 'Invoice line allowance reason code (BT-140) and Invoice line allowance reason (BT-139) shall indicate the same type of allowance reason.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo07(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo07 = schematronRule(rule, evaluateCenEn16931BrCo07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-08',\n level: 'fatal',\n message: 'Invoice line charge reason code (BT-145) and Invoice line charge reason (BT-144) shall indicate the same type of charge reason.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo08(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo08 = schematronRule(rule, evaluateCenEn16931BrCo08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { allVatCompanyIdsHaveValidPrefix, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-09',\n level: 'fatal',\n message:\n 'The Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) shall have a prefix in accordance with ISO code ISO 3166-1 alpha-2 by which the country of issue may be identified. Nevertheless, Greece may use the prefix ‘EL’.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo09(document: PeppolDocument): boolean {\n const passed = allVatCompanyIdsHaveValidPrefix(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo09 = schematronRule(rule, evaluateCenEn16931BrCo09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, getLines, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-10',\n level: 'fatal',\n message: 'Sum of Invoice line net amount (BT-106) = Σ Invoice line net amount (BT-131).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo10(document: PeppolDocument): boolean {\n const passed = amountsEqual(\n round2(document.legalMonetaryTotal.lineExtensionAmount.value),\n round2(getLines(document).reduce((sum, line) => sum + line.lineExtensionAmount.value, 0))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo10 = schematronRule(rule, evaluateCenEn16931BrCo10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-11',\n level: 'fatal',\n message: 'Sum of allowances on document level (BT-107) = Σ Document level allowance amount (BT-92).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo11(document: PeppolDocument): boolean {\n const passed = (() => {\n const allowances = (document.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator);\n if (!document.legalMonetaryTotal.allowanceTotalAmount) {\n return allowances.length === 0;\n }\n return amountsEqual(\n round2(document.legalMonetaryTotal.allowanceTotalAmount.value),\n round2(allowances.reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0))\n );\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo11 = schematronRule(rule, evaluateCenEn16931BrCo11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-12',\n level: 'fatal',\n message: 'Sum of charges on document level (BT-108) = Σ Document level charge amount (BT-99).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo12(document: PeppolDocument): boolean {\n const passed = (() => {\n const charges = (document.allowanceCharges ?? []).filter(ac => ac.chargeIndicator);\n if (!document.legalMonetaryTotal.chargeTotalAmount) {\n return charges.length === 0;\n }\n return amountsEqual(\n round2(document.legalMonetaryTotal.chargeTotalAmount.value),\n round2(charges.reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0))\n );\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo12 = schematronRule(rule, evaluateCenEn16931BrCo12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-13',\n level: 'fatal',\n message:\n 'Invoice total amount without VAT (BT-109) = Σ Invoice line net amount (BT-131) - Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo13(document: PeppolDocument): boolean {\n const passed = (() => {\n const total = document.legalMonetaryTotal;\n const allowance = total.allowanceTotalAmount?.value ?? 0;\n const charge = total.chargeTotalAmount?.value ?? 0;\n return amountsEqual(round2(total.taxExclusiveAmount.value), round2(total.lineExtensionAmount.value + charge - allowance));\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo13 = schematronRule(rule, evaluateCenEn16931BrCo13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-14',\n level: 'fatal',\n message: 'Invoice total VAT amount (BT-110) = Σ VAT category tax amount (BT-117).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo14(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(\n total =>\n (total.taxSubtotals?.length ?? 0) === 0 ||\n amountsEqual(round2(total.taxAmount.value), round2((total.taxSubtotals ?? []).reduce((sum, st) => sum + st.taxAmount.value, 0)))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo14 = schematronRule(rule, evaluateCenEn16931BrCo14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-15',\n level: 'fatal',\n message: 'Invoice total amount with VAT (BT-112) = Invoice total amount without VAT (BT-109) + Invoice total VAT amount (BT-110).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo15(document: PeppolDocument): boolean {\n const passed = (() => {\n const taxTotal = document.taxTotals.find(total => total.taxAmount.currencyId === document.documentCurrencyCode);\n if (!taxTotal) {\n return false;\n }\n if (document.taxTotals.filter(total => total.taxAmount.currencyId === document.documentCurrencyCode).length !== 1) {\n return false;\n }\n return amountsEqual(\n round2(document.legalMonetaryTotal.taxInclusiveAmount.value),\n round2(document.legalMonetaryTotal.taxExclusiveAmount.value + taxTotal.taxAmount.value)\n );\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo15 = schematronRule(rule, evaluateCenEn16931BrCo15);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-16',\n level: 'fatal',\n message: 'Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Paid amount (BT-113) +Rounding amount (BT-114).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo16(document: PeppolDocument): boolean {\n const passed = (() => {\n const total = document.legalMonetaryTotal;\n const prepaid = total.prepaidAmount?.value ?? 0;\n const rounding = total.payableRoundingAmount?.value ?? 0;\n return amountsEqual(round2(total.payableAmount.value - rounding), round2(total.taxInclusiveAmount.value - prepaid));\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo16 = schematronRule(rule, evaluateCenEn16931BrCo16);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule, vatCategoryTaxAmountMatchesRate } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-17',\n level: 'fatal',\n message: 'VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo17(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => vatCategoryTaxAmountMatchesRate(st)));\n return passed;\n}\n\nexport const validateCenEn16931BrCo17 = schematronRule(rule, evaluateCenEn16931BrCo17);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-18',\n level: 'fatal',\n message: 'An Invoice shall at least have one VAT breakdown group (BG-23).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo18(document: PeppolDocument): boolean {\n const passed = document.taxTotals.some(total => (total.taxSubtotals?.length ?? 0) > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrCo18 = schematronRule(rule, evaluateCenEn16931BrCo18);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodHasDateOrDescriptionCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-19',\n level: 'fatal',\n message:\n 'If Invoicing period (BG-14) is used, the Invoicing period start date (BT-73) or the Invoicing period end date (BT-74) shall be filled, or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo19(document: PeppolDocument): boolean {\n const passed = everyPeriodHasDateOrDescriptionCode(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo19 = schematronRule(rule, evaluateCenEn16931BrCo19);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodHasDateOrDescriptionCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-20',\n level: 'fatal',\n message:\n 'If Invoice line period (BG-26) is used, the Invoice line period start date (BT-134) or the Invoice line period end date (BT-135) shall be filled, or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo20(document: PeppolDocument): boolean {\n const passed = everyPeriodHasDateOrDescriptionCode(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo20 = schematronRule(rule, evaluateCenEn16931BrCo20);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-21',\n level: 'fatal',\n message:\n 'Each Document level allowance (BG-20) shall contain a Document level allowance reason (BT-97) or a Document level allowance reason code (BT-98), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo21(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931BrCo21 = schematronRule(rule, evaluateCenEn16931BrCo21);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-22',\n level: 'fatal',\n message:\n 'Each Document level charge (BG-21) shall contain a Document level charge reason (BT-104) or a Document level charge reason code (BT-105), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo22(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931BrCo22 = schematronRule(rule, evaluateCenEn16931BrCo22);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-23',\n level: 'fatal',\n message:\n 'Each Invoice line allowance (BG-27) shall contain an Invoice line allowance reason (BT-139) or an Invoice line allowance reason code (BT-140), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo23(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo23 = schematronRule(rule, evaluateCenEn16931BrCo23);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-24',\n level: 'fatal',\n message:\n 'Each Invoice line charge (BG-28) shall contain an Invoice line charge reason (BT-144) or an Invoice line charge reason code (BT-145), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo24(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo24 = schematronRule(rule, evaluateCenEn16931BrCo24);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-25',\n level: 'fatal',\n message:\n 'In case the Amount due for payment (BT-115) is positive, either the Payment due date (BT-9) or the Payment terms (BT-20) shall be present.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo25(document: PeppolDocument): boolean {\n const passed =\n document.legalMonetaryTotal.payableAmount.value <= 0 || typeof document.dueDate === 'string' || typeof document.paymentTerms?.note === 'string';\n return passed;\n}\n\nexport const validateCenEn16931BrCo25 = schematronRule(rule, evaluateCenEn16931BrCo25);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasSellerLegalCompanyId, hasSellerTaxIdentifier, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-26',\n level: 'fatal',\n message:\n 'In order for the buyer to automatically identify a supplier, the Seller identifier (BT-29), the Seller legal registration identifier (BT-30) and/or the Seller VAT identifier (BT-31) shall be present.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo26(document: PeppolDocument): boolean {\n const passed =\n hasSellerTaxIdentifier(document) ||\n typeof document.accountingSupplierParty.partyIdentification?.id.id === 'string' ||\n hasSellerLegalCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo26 = schematronRule(rule, evaluateCenEn16931BrCo26);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-01',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level allowance amount (BT-92) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec01(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec01 = schematronRule(rule, evaluateCenEn16931BrDec01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-02',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level allowance base amount (BT-93) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec02(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec02 = schematronRule(rule, evaluateCenEn16931BrDec02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-05',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level charge amount (BT-99) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec05(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec05 = schematronRule(rule, evaluateCenEn16931BrDec05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-06',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level charge base amount (BT-100) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec06(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec06 = schematronRule(rule, evaluateCenEn16931BrDec06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-09',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Sum of Invoice line net amount (BT-106) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec09(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.lineExtensionAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.lineExtensionAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec09 = schematronRule(rule, evaluateCenEn16931BrDec09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-10',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Sum of allowanced on document level (BT-107) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec10(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.allowanceTotalAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.allowanceTotalAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec10 = schematronRule(rule, evaluateCenEn16931BrDec10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-11',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Sum of charges on document level (BT-108) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec11(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.chargeTotalAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.chargeTotalAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec11 = schematronRule(rule, evaluateCenEn16931BrDec11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-12',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total amount without VAT (BT-109) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec12(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.taxExclusiveAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.taxExclusiveAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec12 = schematronRule(rule, evaluateCenEn16931BrDec12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-13',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total VAT amount (BT-110) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec13(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(\n total => total.taxAmount.currencyId !== document.documentCurrencyCode || hasMaxTwoDecimals(total.taxAmount.value)\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec13 = schematronRule(rule, evaluateCenEn16931BrDec13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-14',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total amount with VAT (BT-112) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec14(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.taxInclusiveAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.taxInclusiveAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec14 = schematronRule(rule, evaluateCenEn16931BrDec14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-15',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total VAT amount in accounting currency (BT-111) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec15(document: PeppolDocument): boolean {\n const passed =\n !document.taxCurrencyCode ||\n document.taxTotals.every(total => total.taxAmount.currencyId !== document.taxCurrencyCode || hasMaxTwoDecimals(total.taxAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec15 = schematronRule(rule, evaluateCenEn16931BrDec15);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-16',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Paid amount (BT-113) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec16(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.prepaidAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.prepaidAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec16 = schematronRule(rule, evaluateCenEn16931BrDec16);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-17',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Rounding amount (BT-114) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec17(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.payableRoundingAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.payableRoundingAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec17 = schematronRule(rule, evaluateCenEn16931BrDec17);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-18',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Amount due for payment (BT-115) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec18(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.payableAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.payableAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec18 = schematronRule(rule, evaluateCenEn16931BrDec18);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-19',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the VAT category taxable amount (BT-116) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec19(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => hasMaxTwoDecimals(st.taxableAmount.value)));\n return passed;\n}\n\nexport const validateCenEn16931BrDec19 = schematronRule(rule, evaluateCenEn16931BrDec19);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-20',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the VAT category tax amount (BT-117) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec20(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => hasMaxTwoDecimals(st.taxAmount.value)));\n return passed;\n}\n\nexport const validateCenEn16931BrDec20 = schematronRule(rule, evaluateCenEn16931BrDec20);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-23',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line net amount (BT-131) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec23(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => hasMaxTwoDecimals(line.lineExtensionAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec23 = schematronRule(rule, evaluateCenEn16931BrDec23);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-24',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line allowance amount (BT-136) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec24(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec24 = schematronRule(rule, evaluateCenEn16931BrDec24);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-25',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line allowance base amount (BT-137) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec25(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec25 = schematronRule(rule, evaluateCenEn16931BrDec25);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-27',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line charge amount (BT-141) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec27(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec27 = schematronRule(rule, evaluateCenEn16931BrDec27);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-28',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line charge base amount (BT-142) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec28(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec28 = schematronRule(rule, evaluateCenEn16931BrDec28);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Exempt from VAT\" shall contain exactly one VAT breakdown (BG-23) with the VAT category code (BT-118) equal to \"Exempt from VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'E') || countVatBreakdownCode(document, 'E') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrE01 = schematronRule(rule, evaluateCenEn16931BrE01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Exempt from VAT\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'E') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrE02 = schematronRule(rule, evaluateCenEn16931BrE02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Exempt from VAT\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'E') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrE03 = schematronRule(rule, evaluateCenEn16931BrE03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Exempt from VAT\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'E') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrE04 = schematronRule(rule, evaluateCenEn16931BrE04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Exempt from VAT\", the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'E', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE05 = schematronRule(rule, evaluateCenEn16931BrE05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Exempt from VAT\", the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'E', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE06 = schematronRule(rule, evaluateCenEn16931BrE06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Exempt from VAT\", the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'E', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE07 = schematronRule(rule, evaluateCenEn16931BrE07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Exempt from VAT\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Exempt from VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'E').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'E')));\n return passed;\n}\n\nexport const validateCenEn16931BrE08 = schematronRule(rule, evaluateCenEn16931BrE08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) In a VAT breakdown (BG-23) where the VAT category code (BT-118) equals \"Exempt from VAT\" shall equal 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'E').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE09 = schematronRule(rule, evaluateCenEn16931BrE09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Exempt from VAT\" shall have a VAT exemption reason code (BT-121) or a VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'E').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrE10 = schematronRule(rule, evaluateCenEn16931BrE10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Export outside the EU\" shall contain in the VAT breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"Export outside the EU\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'G') || countVatBreakdownCode(document, 'G') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrG01 = schematronRule(rule, evaluateCenEn16931BrG01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerVatCompanyId, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Export outside the EU\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'G') || hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrG02 = schematronRule(rule, evaluateCenEn16931BrG02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Export outside the EU\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG03(document: PeppolDocument): boolean {\n const passed = !hasDocumentAllowanceVatCategoryCode(document, 'G') || hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrG03 = schematronRule(rule, evaluateCenEn16931BrG03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerVatCompanyId, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Export outside the EU\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'G') || hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrG04 = schematronRule(rule, evaluateCenEn16931BrG04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Export outside the EU\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'G', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG05 = schematronRule(rule, evaluateCenEn16931BrG05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Export outside the EU\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'G', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG06 = schematronRule(rule, evaluateCenEn16931BrG06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Export outside the EU\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'G', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG07 = schematronRule(rule, evaluateCenEn16931BrG07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Export outside the EU\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Export outside the EU\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'G').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'G')));\n return passed;\n}\n\nexport const validateCenEn16931BrG08 = schematronRule(rule, evaluateCenEn16931BrG08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Export outside the EU\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'G').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG09 = schematronRule(rule, evaluateCenEn16931BrG09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with the VAT Category code (BT-118) \"Export outside the EU\" shall have a VAT exemption reason code (BT-121), meaning \"Export outside the EU\" or the VAT exemption reason text (BT-120) \"Export outside the EU\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'G').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrG10 = schematronRule(rule, evaluateCenEn16931BrG10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Intra-community supply\" shall contain in the VAT breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"Intra-community supply\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'K') || countVatBreakdownCode(document, 'K') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrIc01 = schematronRule(rule, evaluateCenEn16931BrIc01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasLineVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Intra-community supply\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc02(document: PeppolDocument): boolean {\n const passed =\n !hasLineVatCategoryCode(document, 'K') ||\n ((hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document)) && hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrIc02 = schematronRule(rule, evaluateCenEn16931BrIc02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentAllowanceVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Intra-community supply\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'K') ||\n ((hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document)) && hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrIc03 = schematronRule(rule, evaluateCenEn16931BrIc03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentChargeVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Intra-community supply\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc04(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentChargeVatCategoryCode(document, 'K') ||\n ((hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document)) && hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrIc04 = schematronRule(rule, evaluateCenEn16931BrIc04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Intracommunity supply\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'K', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc05 = schematronRule(rule, evaluateCenEn16931BrIc05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Intra-community supply\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'K', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc06 = schematronRule(rule, evaluateCenEn16931BrIc06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Intra-community supply\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'K', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc07 = schematronRule(rule, evaluateCenEn16931BrIc07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Intra-community supply\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'K').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'K')));\n return passed;\n}\n\nexport const validateCenEn16931BrIc08 = schematronRule(rule, evaluateCenEn16931BrIc08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'K').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc09 = schematronRule(rule, evaluateCenEn16931BrIc09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with the VAT Category code (BT-118) \"Intra-community supply\" shall have a VAT exemption reason code (BT-121), meaning \"Intra-community supply\" or the VAT exemption reason text (BT-120) \"Intra-community supply\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'K').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrIc10 = schematronRule(rule, evaluateCenEn16931BrIc10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-11',\n level: 'fatal',\n message:\n 'In an Invoice with a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" the Actual delivery date (BT-72) or the Invoicing period (BG-14) shall not be blank.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc11(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'K') ||\n (typeof document.delivery?.actualDeliveryDate === 'string' && document.delivery.actualDeliveryDate.trim() !== '') ||\n typeof document.invoicePeriod === 'object';\n return passed;\n}\n\nexport const validateCenEn16931BrIc11 = schematronRule(rule, evaluateCenEn16931BrIc11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-12',\n level: 'fatal',\n message:\n 'In an Invoice with a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" the Deliver to country code (BT-80) shall not be blank.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc12(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'K') ||\n (typeof document.delivery?.deliveryLocation?.address?.countryCode.identificationCode === 'string' &&\n document.delivery.deliveryLocation.address.countryCode.identificationCode.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931BrIc12 = schematronRule(rule, evaluateCenEn16931BrIc12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Not subject to VAT\" shall contain exactly one VAT breakdown group (BG-23) with the VAT category code (BT-118) equal to \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'O') || countVatBreakdownCode(document, 'O') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrO01 = schematronRule(rule, evaluateCenEn16931BrO01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasLineVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Not subject to VAT\" shall not contain the Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) or the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO02(document: PeppolDocument): boolean {\n const passed =\n !hasLineVatCategoryCode(document, 'O') ||\n (!hasSellerVatCompanyId(document) && !hasTaxRepresentativeVatCompanyId(document) && !hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrO02 = schematronRule(rule, evaluateCenEn16931BrO02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentAllowanceVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Not subject to VAT\" shall not contain the Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) or the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'O') ||\n (!hasSellerVatCompanyId(document) && !hasTaxRepresentativeVatCompanyId(document) && !hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrO03 = schematronRule(rule, evaluateCenEn16931BrO03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentChargeVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Not subject to VAT\" shall not contain the Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) or the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO04(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentChargeVatCategoryCode(document, 'O') ||\n (!hasSellerVatCompanyId(document) && !hasTaxRepresentativeVatCompanyId(document) && !hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrO04 = schematronRule(rule, evaluateCenEn16931BrO04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-05',\n level: 'fatal',\n message:\n 'An Invoice line (BG-25) where the VAT category code (BT-151) is \"Not subject to VAT\" shall not contain an Invoiced item VAT rate (BT-152).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'O', percent => percent === undefined);\n return passed;\n}\n\nexport const validateCenEn16931BrO05 = schematronRule(rule, evaluateCenEn16931BrO05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-06',\n level: 'fatal',\n message:\n 'A Document level allowance (BG-20) where VAT category code (BT-95) is \"Not subject to VAT\" shall not contain a Document level allowance VAT rate (BT-96).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'O', percent => percent === undefined);\n return passed;\n}\n\nexport const validateCenEn16931BrO06 = schematronRule(rule, evaluateCenEn16931BrO06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-07',\n level: 'fatal',\n message:\n 'A Document level charge (BG-21) where the VAT category code (BT-102) is \"Not subject to VAT\" shall not contain a Document level charge VAT rate (BT-103).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'O', percent => percent === undefined);\n return passed;\n}\n\nexport const validateCenEn16931BrO07 = schematronRule(rule, evaluateCenEn16931BrO07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \" Not subject to VAT\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'O').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'O')));\n return passed;\n}\n\nexport const validateCenEn16931BrO08 = schematronRule(rule, evaluateCenEn16931BrO08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Not subject to VAT\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'O').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrO09 = schematronRule(rule, evaluateCenEn16931BrO09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \" Not subject to VAT\" shall have a VAT exemption reason code (BT-121), meaning \" Not subject to VAT\" or a VAT exemption reason text (BT-120) \" Not subject to VAT\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'O').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrO10 = schematronRule(rule, evaluateCenEn16931BrO10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countAllVatBreakdowns, countVatBreakdownCode, hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-11',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain other VAT breakdown groups (BG-23).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO11(document: PeppolDocument): boolean {\n const passed = !hasVatBreakdownCode(document, 'O') || countVatBreakdownCode(document, 'O') === countAllVatBreakdowns(document);\n return passed;\n}\n\nexport const validateCenEn16931BrO11 = schematronRule(rule, evaluateCenEn16931BrO11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-12',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is not \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO12(document: PeppolDocument): boolean {\n const passed = !hasVatBreakdownCode(document, 'O') || getLines(document).every(line => line.item.classifiedTaxCategory.id === 'O');\n return passed;\n}\n\nexport const validateCenEn16931BrO12 = schematronRule(rule, evaluateCenEn16931BrO12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-13',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain Document level allowances (BG-20) where Document level allowance VAT category code (BT-95) is not \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO13(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'O') ||\n (document.allowanceCharges ?? []).every(ac => ac.chargeIndicator || ac.taxCategory?.id === undefined || ac.taxCategory.id === 'O');\n return passed;\n}\n\nexport const validateCenEn16931BrO13 = schematronRule(rule, evaluateCenEn16931BrO13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-14',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain Document level charges (BG-21) where Document level charge VAT category code (BT-102) is not \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO14(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'O') ||\n (document.allowanceCharges ?? []).every(ac => !ac.chargeIndicator || ac.taxCategory?.id === undefined || ac.taxCategory.id === 'O');\n return passed;\n}\n\nexport const validateCenEn16931BrO14 = schematronRule(rule, evaluateCenEn16931BrO14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Standard rated\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"Standard rated\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'S') || countVatBreakdownCode(document, 'S') > 0;\n return passed;\n}\n\nexport const validateCenEn16931BrS01 = schematronRule(rule, evaluateCenEn16931BrS01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Standard rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'S') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS02 = schematronRule(rule, evaluateCenEn16931BrS02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Standard rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'S') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS03 = schematronRule(rule, evaluateCenEn16931BrS03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Standard rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'S') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS04 = schematronRule(rule, evaluateCenEn16931BrS04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Standard rated\" the Invoiced item VAT rate (BT-152) shall be greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'S', percent => percent !== undefined && percent > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrS05 = schematronRule(rule, evaluateCenEn16931BrS05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Standard rated\" the Document level allowance VAT rate (BT-96) shall be greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'S', percent => percent !== undefined && percent > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrS06 = schematronRule(rule, evaluateCenEn16931BrS06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Standard rated\" the Document level charge VAT rate (BT-103) shall be greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'S', percent => percent !== undefined && percent > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrS07 = schematronRule(rule, evaluateCenEn16931BrS07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyVatBreakdownTaxableMatchesRateSum, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-08',\n level: 'fatal',\n message:\n 'For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"Standard rated\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"Standard rated\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS08(document: PeppolDocument): boolean {\n const passed = everyVatBreakdownTaxableMatchesRateSum(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS08 = schematronRule(rule, evaluateCenEn16931BrS08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, round2, schematronRule, withinSlackOne } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"Standard rated\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'S').every(st =>\n withinSlackOne(st.taxAmount, round2((st.taxableAmount * (st.taxCategory.percent ?? 0)) / 100))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrS09 = schematronRule(rule, evaluateCenEn16931BrS09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Standard rate\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'S').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrS10 = schematronRule(rule, evaluateCenEn16931BrS10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Zero rated\" shall contain in the VAT breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"Zero rated\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'Z') || countVatBreakdownCode(document, 'Z') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrZ01 = schematronRule(rule, evaluateCenEn16931BrZ01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line where the Invoiced item VAT category code (BT-151) is \"Zero rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'Z') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrZ02 = schematronRule(rule, evaluateCenEn16931BrZ02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Zero rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'Z') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrZ03 = schematronRule(rule, evaluateCenEn16931BrZ03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge where the Document level charge VAT category code (BT-102) is \"Zero rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'Z') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrZ04 = schematronRule(rule, evaluateCenEn16931BrZ04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Zero rated\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'Z', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ05 = schematronRule(rule, evaluateCenEn16931BrZ05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Zero rated\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'Z', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ06 = schematronRule(rule, evaluateCenEn16931BrZ06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Zero rated\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'Z', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ07 = schematronRule(rule, evaluateCenEn16931BrZ07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where VAT category code (BT-118) is \"Zero rated\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amount (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Zero rated\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'Z').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'Z')));\n return passed;\n}\n\nexport const validateCenEn16931BrZ08 = schematronRule(rule, evaluateCenEn16931BrZ08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-09',\n level: 'fatal',\n message: 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"Zero rated\" shall equal 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'Z').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ09 = schematronRule(rule, evaluateCenEn16931BrZ09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Zero rated\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'Z').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrZ10 = schematronRule(rule, evaluateCenEn16931BrZ10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-001',\n level: 'fatal',\n message: 'An invoice shall contain information on \"PAYMENT INSTRUCTIONS\" (BG-16).',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR001(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n return (document.paymentMeans?.length ?? 0) > 0;\n}\n\nexport const validateDeR001 = schematronRule(rule, evaluateDeR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DE-R-002', level: 'fatal', message: 'The group \"SELLER CONTACT\" (BG-6) shall be provided.' } as const satisfies SchematronRule;\n\nfunction evaluateDeR002(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n return Boolean(document.accountingSupplierParty.contact);\n}\n\nexport const validateDeR002 = schematronRule(rule, evaluateDeR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DE-R-003', level: 'fatal', message: 'The element \"Seller city\" (BT-37) shall be provided.' } as const satisfies SchematronRule;\n\nfunction evaluateDeR003(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const cityName = document.accountingSupplierParty.postalAddress.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateDeR003 = schematronRule(rule, evaluateDeR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-004',\n level: 'fatal',\n message: 'The element \"Seller post code\" (BT-38) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR004(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const postalZone = document.accountingSupplierParty.postalAddress.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateDeR004 = schematronRule(rule, evaluateDeR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-005',\n level: 'fatal',\n message: 'The element \"Seller contact point\" (BT-41) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR005(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const name = document.accountingSupplierParty.contact?.name;\n return typeof name === 'string' && name.trim() !== '';\n}\n\nexport const validateDeR005 = schematronRule(rule, evaluateDeR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-006',\n level: 'fatal',\n message: 'The element \"Seller contact telephone number\" (BT-42) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR006(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const telephone = document.accountingSupplierParty.contact?.telephone;\n return typeof telephone === 'string' && telephone.trim() !== '';\n}\n\nexport const validateDeR006 = schematronRule(rule, evaluateDeR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-007',\n level: 'fatal',\n message: 'The element \"Seller contact email address\" (BT-43) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR007(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const email = document.accountingSupplierParty.contact?.electronicMail;\n return typeof email === 'string' && email.trim() !== '';\n}\n\nexport const validateDeR007 = schematronRule(rule, evaluateDeR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DE-R-008', level: 'fatal', message: 'The element \"Buyer city\" (BT-52) shall be provided.' } as const satisfies SchematronRule;\n\nfunction evaluateDeR008(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const cityName = document.accountingCustomerParty.postalAddress.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateDeR008 = schematronRule(rule, evaluateDeR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-009',\n level: 'fatal',\n message: 'The element \"Buyer post code\" (BT-53) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR009(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const postalZone = document.accountingCustomerParty.postalAddress.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateDeR009 = schematronRule(rule, evaluateDeR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-010',\n level: 'fatal',\n message: 'The element \"Deliver to city\" (BT-77) shall be provided if the group \"DELIVER TO ADDRESS\" (BG-15) is delivered.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR010(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const address = document.delivery?.deliveryLocation?.address;\n if (!address) {\n return true;\n }\n const cityName = address.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateDeR010 = schematronRule(rule, evaluateDeR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-011',\n level: 'fatal',\n message: 'The element \"Deliver to post code\" (BT-78) shall be provided if the group \"DELIVER TO ADDRESS\" (BG-15) is delivered.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR011(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const address = document.delivery?.deliveryLocation?.address;\n if (!address) {\n return true;\n }\n const postalZone = address.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateDeR011 = schematronRule(rule, evaluateDeR011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-014',\n level: 'fatal',\n message: 'The element \"VAT category rate\" (BT-119) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR014(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(subtotal => typeof subtotal.taxCategory.percent === 'number' && subtotal.taxCategory.percent > 0)\n );\n return passed;\n}\n\nexport const validateDeR014 = schematronRule(rule, evaluateDeR014);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-015',\n level: 'fatal',\n message: 'The element \"Buyer reference\" (BT-10) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR015(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const buyerReference = document.buyerReference;\n return typeof buyerReference === 'string' && buyerReference.trim() !== '';\n}\n\nexport const validateDeR015 = schematronRule(rule, evaluateDeR015);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, getLines, isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-016',\n level: 'fatal',\n message:\n 'If one of the VAT codes S, Z, E, AE, K, G, L, or M is used, an invoice shall contain at least one of the following elements: \"Seller VAT identifier\" (BT-31) or \"Seller tax registration identifier\" (BT-32) or \"SELLER TAX REPRESENTATIVE PARTY\" (BG-11).',\n} as const satisfies SchematronRule;\n\nconst SUPPORTED_VAT_CODES = new Set(['S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M']);\n\nfunction evaluateDeR016(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const lineCodes = getLines(document).map(line => line.item.classifiedTaxCategory.id);\n const allowanceCodes = getAllAllowanceCharges(document)\n .map(ac => ac.taxCategoryId)\n .filter((code): code is string => code !== undefined);\n const usesSupportedCode = [...lineCodes, ...allowanceCodes].some(code => SUPPORTED_VAT_CODES.has(code));\n if (!usesSupportedCode) {\n return true;\n }\n const hasTaxRepresentative = Boolean(document.taxRepresentativeParty);\n const hasSellerTaxId = document.accountingSupplierParty.partyTaxSchemes?.some(scheme => scheme.companyId.trim() !== '') ?? false;\n return hasTaxRepresentative || hasSellerTaxId;\n}\n\nexport const validateDeR016 = schematronRule(rule, evaluateDeR016);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-017',\n level: 'warning',\n message:\n 'The element \"Invoice type code\" (BT-3) should only contain the following values from code list UNTDID 1001: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice), 381 (Credit note), 875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['326', '380', '384', '389', '381', '875', '876', '877']);\n\nfunction evaluateDeR017(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const code = 'invoiceTypeCode' in document ? document.invoiceTypeCode : 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n return code === undefined || ALLOWED_CODES.has(code);\n}\n\nexport const validateDeR017 = schematronRule(rule, evaluateDeR017);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-018',\n level: 'fatal',\n message:\n 'Information on cash discounts for prompt payment (Skonto) shall be provided within the element \"Payment terms\" BT-20 in the following way: First segment \"SKONTO\", second segment amount of days (\"TAGE=N\"), third segment percentage (\"PROZENT=N\"). Percentage must be separated by dot with two decimal places. In case the base value of the invoiced amount is not provided in BT-115 but as a partial amount, the base value shall be provided as fourth segment \"BASISBETRAG=N\" as semantic data type amount. Each entry shall start with a #, the segments must be separated by # and a row shall end with a #. A complete statement on cash discount for prompt payment shall end with a XML-conformant line break.',\n} as const satisfies SchematronRule;\n\nconst SKONTO_REGEX = /^#(SKONTO)#TAGE=([0-9]+#PROZENT=[0-9]+\\.[0-9]{2})(#BASISBETRAG=-?[0-9]+\\.[0-9]{2})?#$/;\n\nfunction evaluateDeR018(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const note = document.paymentTerms?.note;\n if (note === undefined) {\n return true;\n }\n const lines = note.split(/\\r?\\n/).filter(line => line.startsWith('#'));\n if (lines.length === 0) {\n return true;\n }\n const passed = lines.every(line => SKONTO_REGEX.test(line.trim()));\n return passed;\n}\n\nexport const validateDeR018 = schematronRule(rule, evaluateDeR018);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidIBAN } from '#/peppol-validations/is-valid-iban.ts';\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-019',\n level: 'warning',\n message:\n 'The element \"Payment account identifier\" (BT-84) should contain a valid IBAN if code 58 SEPA is provided in \"Payment means type code\" (BT-81).',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR019(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '58') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId === undefined || isValidIBAN(accountId);\n });\n return passed;\n}\n\nexport const validateDeR019 = schematronRule(rule, evaluateDeR019);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidIBAN } from '#/peppol-validations/is-valid-iban.ts';\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-020',\n level: 'warning',\n message:\n 'The element \"Debited account identifier\" (BT-91) should contain a valid IBAN if code 59 SEPA is provided in \"Payment means type code\" (BT-81). ',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR020(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '59') {\n return true;\n }\n const debitedAccountId = payment.paymentMandate?.payerFinancialAccountId?.id;\n return debitedAccountId === undefined || isValidIBAN(debitedAccountId);\n });\n return passed;\n}\n\nexport const validateDeR020 = schematronRule(rule, evaluateDeR020);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-022',\n level: 'fatal',\n message:\n 'Attached documents provided with an invoice in \"ADDITIONAL SUPPORTING DOCUMENTS\" (BG-24) shall have a unique filename (non case-sensitive) within the element \"Attached document\" (BT-125).',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR022(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const filenames = (document.additionalDocumentReferences ?? [])\n .map(ref => ref.attachment?.embeddedDocumentBinaryObject?.filename)\n .filter((filename): filename is string => filename !== undefined)\n .map(filename => filename.toLowerCase());\n return new Set(filenames).size === filenames.length;\n}\n\nexport const validateDeR022 = schematronRule(rule, evaluateDeR022);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-023-1',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for credit transfer (30, 58), \"CREDIT TRANSFER\" (BG-17) shall be provided.',\n} as const satisfies SchematronRule;\n\nconst CREDIT_TRANSFER_CODES = new Set(['30', '58']);\n\nfunction evaluateDeR023_1(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CREDIT_TRANSFER_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return Boolean(payment.payeeFinancialAccount);\n });\n return passed;\n}\n\nexport const validateDeR023_1 = schematronRule(rule, evaluateDeR023_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-023-2',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for credit transfer (30, 58), BG-18 and BG-19 shall not be provided.',\n} as const satisfies SchematronRule;\n\nconst CREDIT_TRANSFER_CODES = new Set(['30', '58']);\n\nfunction evaluateDeR023_2(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CREDIT_TRANSFER_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return !payment.cardAccount && !payment.paymentMandate;\n });\n return passed;\n}\n\nexport const validateDeR023_2 = schematronRule(rule, evaluateDeR023_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-024-1',\n level: 'fatal',\n message:\n 'If \"Payment means type code\" (BT-81) contains a code for payment card (48, 54, 55), \"PAYMENT CARD INFORMATION\" (BG-18) shall be provided.',\n} as const satisfies SchematronRule;\n\nconst CARD_CODES = new Set(['48', '54', '55']);\n\nfunction evaluateDeR024_1(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CARD_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return Boolean(payment.cardAccount);\n });\n return passed;\n}\n\nexport const validateDeR024_1 = schematronRule(rule, evaluateDeR024_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-024-2',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for payment card (48, 54, 55), BG-17 and BG-19 shall not be provided.',\n} as const satisfies SchematronRule;\n\nconst CARD_CODES = new Set(['48', '54', '55']);\n\nfunction evaluateDeR024_2(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CARD_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return !payment.payeeFinancialAccount && !payment.paymentMandate;\n });\n return passed;\n}\n\nexport const validateDeR024_2 = schematronRule(rule, evaluateDeR024_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-025-1',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for direct debit (59), \"DIRECT DEBIT\" (BG-19) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR025_1(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '59') {\n return true;\n }\n return Boolean(payment.paymentMandate);\n });\n return passed;\n}\n\nexport const validateDeR025_1 = schematronRule(rule, evaluateDeR025_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-025-2',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for direct debit (59), BG-17 and BG-18 shall not be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR025_2(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '59') {\n return true;\n }\n return !payment.payeeFinancialAccount && !payment.cardAccount;\n });\n return passed;\n}\n\nexport const validateDeR025_2 = schematronRule(rule, evaluateDeR025_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-026',\n level: 'warning',\n message:\n 'If \"Invoice type code\" (BT-3) contains the code 384 (Corrected invoice), \"PRECEDING INVOICE REFERENCE\" (BG-3) should be provided at least once.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR026(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const invoiceTypeCode = 'invoiceTypeCode' in document ? document.invoiceTypeCode : undefined;\n const creditNoteTypeCode = 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n if (invoiceTypeCode !== '384' && creditNoteTypeCode !== '384') {\n return true;\n }\n const hasPrecedingInvoiceReference = (document.billingReferences?.length ?? 0) > 0;\n return hasPrecedingInvoiceReference;\n}\n\nexport const validateDeR026 = schematronRule(rule, evaluateDeR026);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-027',\n level: 'warning',\n message: '\"Seller contact telephone number\" (BT-42) should contain a valid telephone number. A valid telephone should consist of 3 digits minimum.',\n} as const satisfies SchematronRule;\n\nconst TELEPHONE_REGEX = /.*([0-9].*){3,}.*/;\n\nfunction evaluateDeR027(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const telephone = document.accountingSupplierParty.contact?.telephone;\n return telephone === undefined || TELEPHONE_REGEX.test(telephone.trim());\n}\n\nexport const validateDeR027 = schematronRule(rule, evaluateDeR027);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-028',\n level: 'warning',\n message:\n '\"Seller contact email address\" (BT-43) should contain exactly one @-sign, which should not be framed by a whitespace or a dot but by at least two characters on each side. A dot should not be the first or last character.',\n} as const satisfies SchematronRule;\n\nconst EMAIL_REGEX =\n /^[a-zA-Z0-9!#$%&\"*+/=?^_`{|}~-]+(\\.[a-zA-Z0-9!#$%&\"*+/=?^_`{|}~-]+)*@([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/;\n\nfunction evaluateDeR028(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const email = document.accountingSupplierParty.contact?.electronicMail;\n return email === undefined || EMAIL_REGEX.test(email.trim());\n}\n\nexport const validateDeR028 = schematronRule(rule, evaluateDeR028);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-030',\n level: 'fatal',\n message: 'If the group \"DIRECT DEBIT\" (BG-19) is delivered, the element \"Bank assigned creditor identifier\" (BT-90) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR030(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const hasPaymentMandate = (document.paymentMeans ?? []).some(payment => Boolean(payment.paymentMandate));\n if (!hasPaymentMandate) {\n return true;\n }\n const hasSepaCreditorId =\n document.accountingSupplierParty.partyIdentification?.id?.schemeId === 'SEPA' ||\n document.payeeParty?.partyIdentification?.id?.schemeId === 'SEPA';\n return hasSepaCreditorId;\n}\n\nexport const validateDeR030 = schematronRule(rule, evaluateDeR030);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-031',\n level: 'fatal',\n message: 'If the group \"DIRECT DEBIT\" (BG-19) is delivered, the element \"Debited account identifier\" (BT-91) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR031(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!payment.paymentMandate) {\n return true;\n }\n return Boolean(payment.paymentMandate.payerFinancialAccountId?.id);\n });\n return passed;\n}\n\nexport const validateDeR031 = schematronRule(rule, evaluateDeR031);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DK-R-002', level: 'fatal', message: 'Danish suppliers MUST provide legal entity (CVR-number)' } as const satisfies SchematronRule;\n\nfunction evaluateDkR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'DK') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId?.id;\n return typeof companyId === 'string' && companyId.trim() !== '';\n}\n\nexport const validateDkR002 = schematronRule(rule, evaluateDkR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-003',\n level: 'warning',\n message: 'If ItemClassification is provided from Danish suppliers, UNSPSC version 19.05.01 or 26.08.01 should be used.',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_VERSIONS = new Set(['19.05.01', '19.0501', '26.08.01', '26.0801']);\n\nfunction evaluateDkR003(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = getLines(document).every(line =>\n (line.item.commodityClassifications ?? []).every(classification => {\n const classificationCode = classification.itemClassification;\n return (\n classificationCode.listId !== 'TST' ||\n (classificationCode.listVersionId !== undefined && ALLOWED_VERSIONS.has(classificationCode.listVersionId))\n );\n })\n );\n return passed;\n}\n\nexport const validateDkR003 = schematronRule(rule, evaluateDkR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-004',\n level: 'fatal',\n message:\n 'When specifying non-VAT Taxes for Danish customers, Danish suppliers MUST use the AllowanceChargeReasonCode=\"ZZZ\" and MUST be specified in AllowanceChargeReason; Either as the 4-digit Tax category or must include a #, but the # is not allowed as first and last character',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR004(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = getAllAllowanceCharges(document).every(ac => {\n if (ac.reasonCode !== 'ZZZ') {\n return true;\n }\n const reason = ac.allowanceChargeReason;\n if (reason === undefined) {\n return false;\n }\n const is4DigitTaxCategory = /^\\d{4}$/.test(reason) && Number(reason) >= 0 && Number(reason) <= 9999;\n const hasHashInside = reason.includes('#') && !reason.startsWith('#') && !reason.endsWith('#');\n return is4DigitTaxCategory || hasHashInside;\n });\n return passed;\n}\n\nexport const validateDkR004 = schematronRule(rule, evaluateDkR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-005',\n level: 'fatal',\n message: 'For Danish suppliers the following Payment means codes are allowed: 1, 10, 31, 42, 48, 49, 50, 58, 59, 93 and 97',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['1', '10', '31', '42', '48', '49', '50', '58', '59', '93', '97']);\n\nfunction evaluateDkR005(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => ALLOWED_CODES.has(payment.paymentMeansCode.code));\n return passed;\n}\n\nexport const validateDkR005 = schematronRule(rule, evaluateDkR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-006',\n level: 'fatal',\n message: 'For Danish suppliers bank account and registration account is mandatory if payment means is 31 or 42',\n} as const satisfies SchematronRule;\n\nconst REQUIRED_CODES = new Set(['31', '42']);\n\nfunction evaluateDkR006(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!REQUIRED_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n const branchId = payment.payeeFinancialAccount?.financialInstitutionBranch?.id;\n return typeof accountId === 'string' && accountId.trim() !== '' && typeof branchId === 'string' && branchId.trim() !== '';\n });\n return passed;\n}\n\nexport const validateDkR006 = schematronRule(rule, evaluateDkR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-007',\n level: 'fatal',\n message: 'For Danish suppliers PaymentMandate/ID and PayerFinancialAccount/ID are mandatory when payment means is 49',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR007(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '49') {\n return true;\n }\n const mandateId = payment.paymentMandate?.id;\n const payerAccountId = payment.paymentMandate?.payerFinancialAccountId?.id;\n return typeof mandateId === 'string' && mandateId.trim() !== '' && typeof payerAccountId === 'string' && payerAccountId.trim() !== '';\n });\n return passed;\n}\n\nexport const validateDkR007 = schematronRule(rule, evaluateDkR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-008',\n level: 'fatal',\n message:\n 'For Danish Suppliers PaymentID is mandatory and MUST start with 01#, 04# or 15# (kortartkode), and PayeeFinancialAccount/ID (Giro kontonummer) is mandatory and must be 7 or 8 numerical characters long, when payment means equals 50 (Giro)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR008(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '50') {\n return true;\n }\n const paymentId = payment.paymentId;\n const giroAccountId = payment.payeeFinancialAccount?.id;\n const startsWithValidPrefix = paymentId ? ['01#', '04#', '15#'].some(prefix => paymentId.startsWith(prefix)) : false;\n return startsWithValidPrefix && typeof giroAccountId === 'string' && /^[0-9]{7,8}$/.test(giroAccountId);\n });\n return passed;\n}\n\nexport const validateDkR008 = schematronRule(rule, evaluateDkR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-009',\n level: 'fatal',\n message:\n 'For Danish Suppliers if the PaymentID is prefixed with 04# or 15# the 16 digits instruction Id must be added to the PaymentID eg. \"04#1234567890123456\" when Payment means equals 50 (Giro)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR009(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '50' || !payment.paymentId) {\n return true;\n }\n const paymentId = payment.paymentId;\n if (paymentId.startsWith('04#') || paymentId.startsWith('15#')) {\n return paymentId.length === 19;\n }\n return true;\n });\n return passed;\n}\n\nexport const validateDkR009 = schematronRule(rule, evaluateDkR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-010',\n level: 'fatal',\n message:\n 'For Danish Suppliers using PaymentMeansCode 93, PaymentID is mandatory. The first three characters of the PaymentID MUST be 71#, 73# or 75# (kortartskode), and PayeeFinancialAccount/ID MUST be exactly 8 characters long.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR010(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '93') {\n return true;\n }\n const paymentId = payment.paymentId;\n const startsWithValidPrefix = paymentId ? ['71#', '73#', '75#'].some(prefix => paymentId.startsWith(prefix)) : false;\n const accountId = payment.payeeFinancialAccount?.id;\n return startsWithValidPrefix && typeof accountId === 'string' && accountId.length === 8;\n });\n return passed;\n}\n\nexport const validateDkR010 = schematronRule(rule, evaluateDkR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-011',\n level: 'fatal',\n message:\n 'For Danish Suppliers if the PaymentID is prefixed with 71# or 75# the 15-16 digits instruction Id must be added to the PaymentID eg. \"71#1234567890123456\" when payment Method equals 93 (FIK)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR011(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '93' || !payment.paymentId) {\n return true;\n }\n const paymentId = payment.paymentId;\n if (paymentId.startsWith('71#') || paymentId.startsWith('75#')) {\n return paymentId.length === 18 || paymentId.length === 19;\n }\n return true;\n });\n return passed;\n}\n\nexport const validateDkR011 = schematronRule(rule, evaluateDkR011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-013',\n level: 'fatal',\n message:\n 'For Danish Suppliers it is mandatory to use schemeID when PartyIdentification/ID is used for AccountingCustomerParty or AccountingSupplierParty',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR013(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const parties = [document.accountingSupplierParty, document.accountingCustomerParty];\n const passed = parties.every(party => {\n const id = party.partyIdentification?.id;\n return !id?.id || (typeof id.schemeId === 'string' && id.schemeId.trim() !== '');\n });\n return passed;\n}\n\nexport const validateDkR013 = schematronRule(rule, evaluateDkR013);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-014',\n level: 'fatal',\n message:\n 'For Danish Suppliers it is mandatory to specify schemeID as \"0184\" (DK CVR-number) when PartyLegalEntity/CompanyID is used for AccountingSupplierParty',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR014(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'DK') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n const passed = !companyId?.id || companyId.schemeId === '0184';\n return passed;\n}\n\nexport const validateDkR014 = schematronRule(rule, evaluateDkR014);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-016',\n level: 'fatal',\n message: 'For Danish Suppliers, a Credit note cannot have a negative total (PayableAmount)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR016(document: PeppolDocument): boolean {\n if (!('creditNoteLines' in document) || !isDanishSupplierAndCustomer(document)) {\n return true;\n }\n return document.legalMonetaryTotal.payableAmount.value >= 0;\n}\n\nexport const validateDkR016 = schematronRule(rule, evaluateDkR016);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-017',\n level: 'warning',\n message:\n 'For Danish Customers it is mandatory to specify schemeID as \"0184\" (DK CVR-number) when PartyLegalEntity/CompanyID is used for AccountingCustomerParty',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR017(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const companyId = document.accountingCustomerParty.partyLegalEntity.companyId;\n const passed = !companyId?.id || companyId.schemeId === '0184';\n return passed;\n}\n\nexport const validateDkR017 = schematronRule(rule, evaluateDkR017);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-1',\n level: 'fatal',\n message: ' When the Supplier is Greek, the Invoice Id should consist of 6 segments',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_1(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n return segments.length === 6;\n}\n\nexport const validateGrR001_1 = schematronRule(rule, evaluateGrR001_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-2',\n level: 'fatal',\n message:\n \"When the Supplier is Greek, the Invoice Id first segment must be a valid TIN Number and match either the Supplier's or the Tax Representative's Tin Number\",\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_2(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const firstSegment = segments[0];\n if (!firstSegment || firstSegment.trim().length !== 9) {\n return false;\n }\n const supplierTin = document.accountingSupplierParty.partyTaxSchemes\n ?.find(scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT')\n ?.companyId.slice(2);\n const taxRepTin = document.taxRepresentativeParty?.partyTaxScheme.companyId.slice(2);\n const matchesTin = firstSegment === supplierTin || firstSegment === taxRepTin;\n return greekTinVerification(firstSegment) && matchesTin;\n}\n\nexport const validateGrR001_2 = schematronRule(rule, evaluateGrR001_2);\n","import { Schema } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { PeppolIsoDateString } from '#/schemas/peppol-iso-date-string.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-3',\n level: 'fatal',\n message: 'When the Supplier is Greek, the Invoice Id second segment must be a valid Date that matches the invoice Issue Date',\n} as const satisfies SchematronRule;\n\nconst DATE_REGEX = /^(0?[1-9]|[12][0-9]|3[01])[-/]?(0?[1-9]|1[0-2])[-/]?((?:19|20)[0-9]{2})$/;\nconst encodeDateSync = Schema.encodeSync(PeppolIsoDateString);\n\nfunction evaluateGrR001_3(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const secondSegment = segments[1];\n if (!secondSegment || secondSegment.trim().length === 0) {\n return false;\n }\n const dateMatch = secondSegment.match(DATE_REGEX);\n if (!dateMatch) {\n return false;\n }\n const [, day, month, year] = dateMatch;\n const issueDate = encodeDateSync(document.issueDate);\n const issueDateSegments = issueDate.split('-');\n return day === issueDateSegments[2] && month === issueDateSegments[1] && year === issueDateSegments[0];\n}\n\nexport const validateGrR001_3 = schematronRule(rule, evaluateGrR001_3);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-4',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id third segment must be a positive integer',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_4(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const thirdSegment = segments[2];\n if (!thirdSegment || thirdSegment.trim().length === 0) {\n return false;\n }\n return /^\\d+$/.test(thirdSegment) && Number(thirdSegment) >= 0;\n}\n\nexport const validateGrR001_4 = schematronRule(rule, evaluateGrR001_4);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-5',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id in the fourth segment must be a valid greek document type',\n} as const satisfies SchematronRule;\n\nconst GREEK_DOCUMENT_TYPES = new Set(['1.1', '1.6', '2.1', '2.4', '5.1', '5.2']);\n\nfunction evaluateGrR001_5(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const fourthSegment = segments[3];\n if (!fourthSegment || fourthSegment.trim().length === 0) {\n return false;\n }\n return GREEK_DOCUMENT_TYPES.has(fourthSegment);\n}\n\nexport const validateGrR001_5 = schematronRule(rule, evaluateGrR001_5);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-6',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id fifth segment must not be empty',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_6(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n return (segments[4]?.length ?? 0) > 0;\n}\n\nexport const validateGrR001_6 = schematronRule(rule, evaluateGrR001_6);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-7',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id sixth segment must not be empty',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_7(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n return (segments[5]?.length ?? 0) > 0;\n}\n\nexport const validateGrR001_7 = schematronRule(rule, evaluateGrR001_7);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-002',\n level: 'fatal',\n message:\n 'Greek Suppliers must provide their full name as they are registered in the Greek Business Registry (G.E.MH.) as a legal entity or in the Tax Registry as a natural person ',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const partyName = document.accountingSupplierParty.partyName?.name;\n return typeof partyName === 'string' && partyName.length > 0;\n}\n\nexport const validateGrR002 = schematronRule(rule, evaluateGrR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-003',\n level: 'fatal',\n message: \"For the Greek Suppliers, the VAT must start with 'EL' and must be a valid TIN number\",\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(\n scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT'\n )?.companyId;\n if (!vatCompanyId) {\n return false;\n }\n return vatCompanyId.startsWith('EL') && greekTinVerification(vatCompanyId.slice(2));\n}\n\nexport const validateGrR003 = schematronRule(rule, evaluateGrR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-004-1',\n level: 'fatal',\n message: ' When Supplier is Greek, there must be one MARK Number',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR004_1(document: PeppolDocument): boolean {\n const isGreek = getSupplierCountry(document) === 'GR' || getSupplierCountry(document) === 'EL';\n if (!isGreek) {\n return true;\n }\n const markCount = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##M.AR.K##').length;\n return markCount === 1;\n}\n\nexport const validateGrR004_1 = schematronRule(rule, evaluateGrR004_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-004-2',\n level: 'fatal',\n message: 'When Supplier is Greek, the MARK Number must be a positive integer',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR004_2(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const markReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##M.AR.K##');\n const passed = markReferences.every(ref => /^[1-9][0-9]*$/.test(ref.id.id));\n return passed;\n}\n\nexport const validateGrR004_2 = schematronRule(rule, evaluateGrR004_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'GR-R-005', level: 'fatal', message: 'Greek Suppliers must provide the full name of the buyer' } as const satisfies SchematronRule;\n\nfunction evaluateGrR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const partyName = document.accountingCustomerParty.partyName?.name;\n return typeof partyName === 'string' && partyName.length > 0;\n}\n\nexport const validateGrR005 = schematronRule(rule, evaluateGrR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-006',\n level: 'fatal',\n message: 'Greek Suppliers must provide the VAT number of the buyer, if the buyer is Greek ',\n} as const satisfies SchematronRule;\n\nconst isGreekCountry = (country: string): boolean => country === 'GR' || country === 'EL';\n\nfunction evaluateGrR006(document: PeppolDocument): boolean {\n if (!isGreekCountry(getSupplierCountry(document)) || !isGreekCountry(getCustomerCountry(document))) {\n return true;\n }\n const vatSchemes = (document.accountingCustomerParty.partyTaxSchemes ?? []).filter(scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT');\n if (vatSchemes.length !== 1) {\n return false;\n }\n const companyId = vatSchemes[0]?.companyId ?? '';\n return companyId.startsWith('EL') && greekTinVerification(companyId.slice(2));\n}\n\nexport const validateGrR006 = schematronRule(rule, evaluateGrR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-008-2',\n level: 'fatal',\n message: 'When Supplier is Greek, there should be no more than one invoice url',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR008_2(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const urlCount = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##INVOICE|URL##').length;\n return urlCount <= 1;\n}\n\nexport const validateGrR008_2 = schematronRule(rule, evaluateGrR008_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-008-3',\n level: 'fatal',\n message: 'When Supplier is Greek and the INVOICE URL Document reference exists, the External Reference URI should be present',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR008_3(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const urlReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##INVOICE|URL##');\n const passed = urlReferences.every(ref => {\n const uri = ref.attachment?.externalReference?.uri;\n return typeof uri === 'string' && uri.trim() !== '';\n });\n return passed;\n}\n\nexport const validateGrR008_3 = schematronRule(rule, evaluateGrR008_3);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-009',\n level: 'fatal',\n message:\n 'Greek suppliers that send an invoice through the PEPPOL network must use a correct TIN number as an electronic address according to PEPPOL Electronic Address Identifier scheme (schemeID 9933).',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR009(document: PeppolDocument): boolean {\n const supplierCountry = getSupplierCountry(document);\n if (supplierCountry !== 'GR' && supplierCountry !== 'EL') {\n return true;\n }\n const endpointId = document.accountingSupplierParty.endpointId;\n return endpointId?.schemeId === '9933' && greekTinVerification(endpointId.id);\n}\n\nexport const validateGrR009 = schematronRule(rule, evaluateGrR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-010',\n level: 'fatal',\n message:\n 'Greek Suppliers that send an invoice through the PEPPOL network to a greek buyer must use a correct TIN number as an electronic address according to PEPPOL Electronic Address Identifier scheme (SchemeID 9933)',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR010(document: PeppolDocument): boolean {\n const isGreekSupplier = getSupplierCountry(document) === 'GR' || getSupplierCountry(document) === 'EL';\n const isGreekCustomer = getCustomerCountry(document) === 'GR' || getCustomerCountry(document) === 'EL';\n if (!isGreekSupplier || !isGreekCustomer) {\n return true;\n }\n const endpointId = document.accountingCustomerParty.endpointId;\n return endpointId?.schemeId === '9933' && greekTinVerification(endpointId.id);\n}\n\nexport const validateGrR010 = schematronRule(rule, evaluateGrR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-S-008-1',\n level: 'warning',\n message: 'When Supplier is Greek, there should be one invoice url',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrS008_1(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const urlCount = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##INVOICE|URL##').length;\n return urlCount === 1;\n}\n\nexport const validateGrS008_1 = schematronRule(rule, evaluateGrS008_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-S-011',\n level: 'warning',\n message: 'Greek suppliers must provide their Seller Tax Registration Number, prefixed by the country code',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrS011(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const vatSchemes = document.accountingSupplierParty.partyTaxSchemes?.filter(scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT') ?? [];\n if (vatSchemes.length !== 1) {\n return false;\n }\n const companyId = vatSchemes[0]?.companyId ?? '';\n return companyId.startsWith('EL');\n}\n\nexport const validateGrS011 = schematronRule(rule, evaluateGrS011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-001',\n level: 'warning',\n message: '[IS-R-001]-If seller is icelandic then invoice type should be 380 or 381',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['380', '381']);\n\nfunction evaluateIsR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const code = 'invoiceTypeCode' in document ? document.invoiceTypeCode : 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n return code !== undefined && !code.includes(' ') && ALLOWED_CODES.has(code);\n}\n\nexport const validateIsR001 = schematronRule(rule, evaluateIsR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-002',\n level: 'fatal',\n message: '[IS-R-002]-If seller is icelandic then it shall contain sellers legal id',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return Boolean(companyId?.id) && companyId?.schemeId === '0196';\n}\n\nexport const validateIsR002 = schematronRule(rule, evaluateIsR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-003',\n level: 'fatal',\n message: '[IS-R-003]-If seller is icelandic then it shall contain his address with street name and zip code',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const address = document.accountingSupplierParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.postalZone);\n}\n\nexport const validateIsR003 = schematronRule(rule, evaluateIsR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-004',\n level: 'fatal',\n message: '[IS-R-004]-If seller and buyer are icelandic then the invoice shall contain the buyers icelandic legal identifier',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS' || getCustomerCountry(document) !== 'IS') {\n return true;\n }\n const companyId = document.accountingCustomerParty.partyLegalEntity.companyId;\n return Boolean(companyId?.id) && companyId?.schemeId === '0196';\n}\n\nexport const validateIsR004 = schematronRule(rule, evaluateIsR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-005',\n level: 'fatal',\n message: '[IS-R-005]-If seller and buyer are icelandic then the invoice shall contain the buyers address with street name and zip code',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS' || getCustomerCountry(document) !== 'IS') {\n return true;\n }\n const address = document.accountingCustomerParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.postalZone);\n}\n\nexport const validateIsR005 = schematronRule(rule, evaluateIsR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-006',\n level: 'fatal',\n message: '[IS-R-006]-If seller is icelandic and payment means code is 9 then a 12 digit account id must exist',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR006(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const code9Payments = (document.paymentMeans ?? []).filter(payment => payment.paymentMeansCode.code === '9');\n if (code9Payments.length === 0) {\n return true;\n }\n const passed = code9Payments.every(payment => {\n const accountId = payment.payeeFinancialAccount?.id;\n return typeof accountId === 'string' && accountId.trim().length === 12;\n });\n return passed;\n}\n\nexport const validateIsR006 = schematronRule(rule, evaluateIsR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-007',\n level: 'fatal',\n message: '[IS-R-007]-If seller is icelandic and payment means code is 42 then a 12 digit account id must exist',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR007(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const code42Payments = (document.paymentMeans ?? []).filter(payment => payment.paymentMeansCode.code === '42');\n if (code42Payments.length === 0) {\n return true;\n }\n const passed = code42Payments.every(payment => {\n const accountId = payment.payeeFinancialAccount?.id;\n return typeof accountId === 'string' && accountId.trim().length === 12;\n });\n return passed;\n}\n\nexport const validateIsR007 = schematronRule(rule, evaluateIsR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-008',\n level: 'fatal',\n message: '[IS-R-008]-If seller is icelandic and invoice contains supporting description EINDAGI then the id form must be YYYY-MM-DD',\n} as const satisfies SchematronRule;\n\nconst DATE_REGEX = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nfunction evaluateIsR008(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const eindagiReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === 'EINDAGI');\n if (eindagiReferences.length === 0) {\n return true;\n }\n const passed = eindagiReferences.every(ref => {\n const id = ref.id.id;\n return id.length === 10 && DATE_REGEX.test(id) && !Number.isNaN(Date.parse(id));\n });\n return passed;\n}\n\nexport const validateIsR008 = schematronRule(rule, evaluateIsR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-009',\n level: 'fatal',\n message: '[IS-R-009]-If seller is icelandic and invoice contains supporting description EINDAGI invoice must have due date',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR009(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const hasEindagi = (document.additionalDocumentReferences ?? []).some(ref => ref.documentDescription === 'EINDAGI');\n if (!hasEindagi) {\n return true;\n }\n return Boolean(document.dueDate);\n}\n\nexport const validateIsR009 = schematronRule(rule, evaluateIsR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-010',\n level: 'fatal',\n message: '[IS-R-010]-If seller is icelandic and invoice contains supporting description EINDAGI the id date must be same or later than due date',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR010(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const eindagiReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === 'EINDAGI');\n if (eindagiReferences.length === 0) {\n return true;\n }\n const dueDate = document.dueDate;\n if (!dueDate) {\n return false;\n }\n const passed = eindagiReferences.every(ref => {\n const id = ref.id.id;\n return id >= dueDate;\n });\n return passed;\n}\n\nexport const validateIsR010 = schematronRule(rule, evaluateIsR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-001',\n level: 'fatal',\n message: '[IT-R-001] BT-32 (Seller tax registration identifier) - For Italian suppliers BT-32 minimum length 11 and maximum length shall be 16.',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const companyIds =\n document.accountingSupplierParty.partyTaxSchemes?.filter(scheme => scheme.taxSchemeId.id !== 'VAT').map(scheme => scheme.companyId) ?? [];\n const passed = companyIds.every(id => /^[A-Z0-9]{11,16}$/.test(id));\n return passed;\n}\n\nexport const validateItR001 = schematronRule(rule, evaluateItR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-002',\n level: 'fatal',\n message: '[IT-R-002] BT-35 (Seller address line 1) - Italian suppliers MUST provide the postal address line 1',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const streetName = document.accountingSupplierParty.postalAddress.streetName;\n return typeof streetName === 'string' && streetName.trim() !== '';\n}\n\nexport const validateItR002 = schematronRule(rule, evaluateItR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-003',\n level: 'fatal',\n message: '[IT-R-003] BT-37 (Seller city) - Italian suppliers MUST provide the postal address city',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const cityName = document.accountingSupplierParty.postalAddress.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateItR003 = schematronRule(rule, evaluateItR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-004',\n level: 'fatal',\n message: '[IT-R-004] BT-38 (Seller post code) - Italian suppliers MUST provide the postal address post code',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const postalZone = document.accountingSupplierParty.postalAddress.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateItR004 = schematronRule(rule, evaluateItR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-001',\n level: 'fatal',\n message:\n '[NL-R-001] For suppliers in the Netherlands, if the document is a creditnote, the document MUST contain an invoice reference (cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID)',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || !('creditNoteTypeCode' in document)) {\n return true;\n }\n const invoiceReference = document.billingReferences?.some(ref => Boolean(ref.invoiceDocumentReference.id));\n return Boolean(invoiceReference);\n}\n\nexport const validateNlR001 = schematronRule(rule, evaluateNlR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-002',\n level: 'fatal',\n message:\n \"[NL-R-002] For suppliers in the Netherlands the supplier's address (cac:AccountingSupplierParty/cac:Party/cac:PostalAddress) MUST contain street name (cbc:StreetName), city (cbc:CityName) and post code (cbc:PostalZone)\",\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const address = document.accountingSupplierParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.cityName) && Boolean(address.postalZone);\n}\n\nexport const validateNlR002 = schematronRule(rule, evaluateNlR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-003',\n level: 'fatal',\n message: '[NL-R-003] For suppliers in the Netherlands, the legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_SCHEMES = new Set(['0106', '0190']);\n\nfunction evaluateNlR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n if (!companyId?.id) {\n return true;\n }\n return Boolean(companyId.schemeId && ALLOWED_SCHEMES.has(companyId.schemeId));\n}\n\nexport const validateNlR003 = schematronRule(rule, evaluateNlR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-004',\n level: 'fatal',\n message:\n '[NL-R-004] For suppliers in the Netherlands, if the customer is in the Netherlands, the customer address (cac:AccountingCustomerParty/cac:Party/cac:PostalAddress) MUST contain the street name (cbc:StreetName), the city (cbc:CityName) and post code (cbc:PostalZone)',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || getCustomerCountry(document) !== 'NL') {\n return true;\n }\n const address = document.accountingCustomerParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.cityName) && Boolean(address.postalZone);\n}\n\nexport const validateNlR004 = schematronRule(rule, evaluateNlR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-005',\n level: 'fatal',\n message:\n \"[NL-R-005] For suppliers in the Netherlands, if the customer is in the Netherlands, the customer's legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)\",\n} as const satisfies SchematronRule;\n\nconst ALLOWED_SCHEMES = new Set(['0106', '0190']);\n\nfunction evaluateNlR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || getCustomerCountry(document) !== 'NL') {\n return true;\n }\n const companyId = document.accountingCustomerParty.partyLegalEntity.companyId;\n if (!companyId?.id) {\n return true;\n }\n return Boolean(companyId.schemeId && ALLOWED_SCHEMES.has(companyId.schemeId));\n}\n\nexport const validateNlR005 = schematronRule(rule, evaluateNlR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-006',\n level: 'fatal',\n message:\n \"[NL-R-006] For suppliers in the Netherlands, if the fiscal representative is in the Netherlands, the representative's address (cac:TaxRepresentativeParty/cac:PostalAddress) MUST contain street name (cbc:StreetName), city (cbc:CityName) and post code (cbc:PostalZone)\",\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR006(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const taxRep = document.taxRepresentativeParty;\n if (!taxRep || taxRep.postalAddress.countryCode.identificationCode.toUpperCase() !== 'NL') {\n return true;\n }\n const address = taxRep.postalAddress;\n return Boolean(address.streetName) && Boolean(address.cityName) && Boolean(address.postalZone);\n}\n\nexport const validateNlR006 = schematronRule(rule, evaluateNlR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-007',\n level: 'fatal',\n message:\n '[NL-R-007] For suppliers in the Netherlands, the supplier MUST provide a means of payment (cac:PaymentMeans) if the payment is from customer to supplier',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR007(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const payable = document.legalMonetaryTotal.payableAmount.value;\n const isInvoice = 'invoiceLines' in document;\n const isCreditNote = 'creditNoteLines' in document;\n if ((isInvoice && payable <= 0) || (isCreditNote && payable >= 0)) {\n return true;\n }\n return (document.paymentMeans?.length ?? 0) > 0;\n}\n\nexport const validateNlR007 = schematronRule(rule, evaluateNlR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-008',\n level: 'fatal',\n message:\n '[NL-R-008] For suppliers in the Netherlands, if the customer is in the Netherlands, the payment means code (cac:PaymentMeans/cbc:PaymentMeansCode) MUST be one of 30, 48, 49, 57, 58 or 59',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['30', '48', '49', '57', '58', '59']);\n\nfunction evaluateNlR008(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || getCustomerCountry(document) !== 'NL') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => ALLOWED_CODES.has(payment.paymentMeansCode.code));\n return passed;\n}\n\nexport const validateNlR008 = schematronRule(rule, evaluateNlR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-009',\n level: 'fatal',\n message:\n '[NL-R-009] For suppliers in the Netherlands, if an order line reference (cac:OrderLineReference/cbc:LineID) is used, there must be an order reference on the document level (cac:OrderReference/cbc:ID)',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR009(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const hasOrderLineReference = getLines(document).some(line => Boolean(line.orderLineReference?.lineId));\n if (!hasOrderLineReference) {\n return true;\n }\n return Boolean(document.orderReference?.id);\n}\n\nexport const validateNlR009 = schematronRule(rule, evaluateNlR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidMod11 } from '#/peppol-validations/is-valid-mod11.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NO-R-001',\n level: 'fatal',\n message:\n 'For Norwegian suppliers, a VAT number MUST be the country code prefix NO followed by a valid Norwegian organization number (nine numbers) followed by the letters MVA.',\n} as const satisfies SchematronRule;\n\nfunction evaluateNoR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NO') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'VAT')?.companyId;\n if (!vatCompanyId || vatCompanyId.slice(0, 2) !== 'NO') {\n return true;\n }\n const orgNumber = vatCompanyId.slice(2);\n const passed = /^[0-9]{9}MVA$/.test(orgNumber) && isValidMod11(orgNumber.slice(0, 9));\n return passed;\n}\n\nexport const validateNoR001 = schematronRule(rule, evaluateNoR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NO-R-002',\n level: 'warning',\n message: 'For Norwegian suppliers, most invoice issuers are required to append \"Foretaksregisteret\" to their invoice.',\n} as const satisfies SchematronRule;\n\nfunction evaluateNoR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NO') {\n return true;\n }\n const taxCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'TAX')?.companyId;\n return taxCompanyId === 'Foretaksregisteret';\n}\n\nexport const validateNoR002 = schematronRule(rule, evaluateNoR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\nimport { mimeCodesKeys } from '#/values/mime-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL001',\n level: 'fatal',\n message: 'Mime code must be according to subset of IANA code list.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL001(document: PeppolDocument): boolean {\n const mimeCodes = (document.additionalDocumentReferences ?? []).flatMap(ref => {\n const binary = ref.attachment?.embeddedDocumentBinaryObject;\n return binary ? [binary.mimeCode] : [];\n });\n const passed = mimeCodes.every(code => (mimeCodesKeys as ReadonlyArray<string>).includes(code));\n return passed;\n}\n\nexport const validatePeppolEn16931CL001 = schematronRule(rule, evaluatePeppolEn16931CL001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\nimport { allowanceChargeReasonCodesKeys } from '#/values/allowance-charge-reason-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL002',\n level: 'fatal',\n message: 'Reason code MUST be according to subset of UNCL 5189 D.16B.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL002(document: PeppolDocument): boolean {\n const allowances = getAllAllowanceCharges(document).filter(ac => !ac.chargeIndicator);\n const passed = allowances.every(\n ac => ac.reasonCode === undefined || (allowanceChargeReasonCodesKeys as ReadonlyArray<string>).includes(ac.reasonCode)\n );\n return passed;\n}\n\nexport const validatePeppolEn16931CL002 = schematronRule(rule, evaluatePeppolEn16931CL002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\nimport { chargeReasonCodesKeys } from '#/values/charge-reason-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL003',\n level: 'fatal',\n message: 'Reason code MUST be according to UNCL 7161 D.16B.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL003(document: PeppolDocument): boolean {\n const charges = getAllAllowanceCharges(document).filter(ac => ac.chargeIndicator);\n const passed = charges.every(ac => ac.reasonCode === undefined || (chargeReasonCodesKeys as ReadonlyArray<string>).includes(ac.reasonCode));\n return passed;\n}\n\nexport const validatePeppolEn16931CL003 = schematronRule(rule, evaluatePeppolEn16931CL003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\nimport { vatDateCodesKeys } from '#/values/vat-dates.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL006',\n level: 'fatal',\n message: 'Invoice period description code must be according to UNCL 2005 D.16B.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL006(document: PeppolDocument): boolean {\n const descriptionCode = document.invoicePeriod?.descriptionCode;\n if (descriptionCode === undefined) {\n return true;\n }\n return (vatDateCodesKeys as ReadonlyArray<string>).includes(descriptionCode);\n}\n\nexport const validatePeppolEn16931CL006 = schematronRule(rule, evaluatePeppolEn16931CL006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\nimport { currencyCodesKeys } from '#/values/currency-code.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL007',\n level: 'fatal',\n message: 'Currency code must be according to ISO 4217:2005',\n} as const satisfies SchematronRule;\n\nconst isValidCurrency = (code: string): boolean => (currencyCodesKeys as ReadonlyArray<string>).includes(code);\n\nconst collectCurrencies = (document: PeppolDocument): Array<string> => {\n const total = document.legalMonetaryTotal;\n const optionalTotalCurrencies = [\n total.allowanceTotalAmount?.currencyId,\n total.chargeTotalAmount?.currencyId,\n total.prepaidAmount?.currencyId,\n total.payableRoundingAmount?.currencyId,\n ].filter((code): code is string => code !== undefined);\n\n return [\n document.documentCurrencyCode,\n ...(document.taxCurrencyCode ? [document.taxCurrencyCode] : []),\n ...getLines(document).flatMap(line => [line.lineExtensionAmount.currencyId, line.price.priceAmount.currencyId]),\n total.lineExtensionAmount.currencyId,\n total.taxExclusiveAmount.currencyId,\n total.taxInclusiveAmount.currencyId,\n total.payableAmount.currencyId,\n ...optionalTotalCurrencies,\n ...document.taxTotals.flatMap(taxTotal => [\n taxTotal.taxAmount.currencyId,\n ...(taxTotal.taxSubtotals ?? []).flatMap(subtotal => [subtotal.taxAmount.currencyId, subtotal.taxableAmount.currencyId]),\n ]),\n ];\n};\n\nfunction evaluatePeppolEn16931CL007(document: PeppolDocument): boolean {\n return collectCurrencies(document).every(isValidCurrency);\n}\n\nexport const validatePeppolEn16931CL007 = schematronRule(rule, evaluatePeppolEn16931CL007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\nimport { electronicAddressCodesKeys } from '#/values/eas-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL008',\n level: 'fatal',\n message: 'Electronic address identifier scheme must be from the codelist \"Electronic Address Identifier Scheme\"',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL008(document: PeppolDocument): boolean {\n const schemeIds: Array<string | undefined> = [\n document.accountingSupplierParty.endpointId?.schemeId,\n document.accountingCustomerParty.endpointId?.schemeId,\n ];\n const passed = schemeIds.every(schemeId => schemeId === undefined || (electronicAddressCodesKeys as ReadonlyArray<string>).includes(schemeId));\n return passed;\n}\n\nexport const validatePeppolEn16931CL008 = schematronRule(rule, evaluatePeppolEn16931CL008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidGLN } from '#/peppol-validations/is-valid-gln.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R040',\n level: 'fatal',\n message: 'GLN must have a valid format according to GS1 rules.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0088';\n\nfunction evaluatePeppolCommonR040(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]+$/.test(normalizeSpace(i.id)) && isValidGLN(normalizeSpace(i.id)).success);\n return passed;\n}\n\nexport const validatePeppolCommonR040 = schematronRule(rule, evaluatePeppolCommonR040);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidMod11 } from '#/peppol-validations/is-valid-mod11.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R041',\n level: 'fatal',\n message: 'Norwegian organization number MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0192';\n\nfunction evaluatePeppolCommonR041(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]{9}$/.test(normalizeSpace(i.id)) && isValidMod11(normalizeSpace(i.id)));\n return passed;\n}\n\nexport const validatePeppolCommonR041 = schematronRule(rule, evaluatePeppolCommonR041);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R042',\n level: 'fatal',\n message: 'Danish organization number (CVR) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0184';\n\nfunction evaluatePeppolCommonR042(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => {\n const value = i.id;\n const isDkPrefixed = value.length === 10 && value.startsWith('DK') && value.slice(2).replace(/[0-9]/g, '').length === 0;\n const isDigitsOnly = value.length === 8 && value.replace(/[0-9]/g, '').length === 0;\n return isDkPrefixed || isDigitsOnly;\n });\n return passed;\n}\n\nexport const validatePeppolCommonR042 = schematronRule(rule, evaluatePeppolCommonR042);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidMod97_0208 } from '#/peppol-validations/is-valid-mod97-0208.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R043',\n level: 'fatal',\n message: 'Belgian enterprise number MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0208';\n\nfunction evaluatePeppolCommonR043(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]{10}$/.test(normalizeSpace(i.id)) && isValidMod97_0208(normalizeSpace(i.id)).success);\n return passed;\n}\n\nexport const validatePeppolCommonR043 = schematronRule(rule, evaluatePeppolCommonR043);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R044',\n level: 'warning',\n message: 'IPA Code (Codice Univoco Unità Organizzativa) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0201';\nconst ALLOWED_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n\nfunction evaluatePeppolCommonR044(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.length === 6 && i.id.split('').every(c => ALLOWED_CHARACTERS.includes(c)));\n return passed;\n}\n\nexport const validatePeppolCommonR044 = schematronRule(rule, evaluatePeppolCommonR044);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkCF } from '#/peppol-validations/check-cf.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R045',\n level: 'warning',\n message: 'Tax Code (Codice Fiscale) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0210';\n\nfunction evaluatePeppolCommonR045(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => checkCF(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR045 = schematronRule(rule, evaluatePeppolCommonR045);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkCF } from '#/peppol-validations/check-cf.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R046',\n level: 'warning',\n message: 'Tax Code (Codice Fiscale) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '9907';\n\nfunction evaluatePeppolCommonR046(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => checkCF(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR046 = schematronRule(rule, evaluatePeppolCommonR046);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkPIVAseIT } from '#/peppol-validations/check-piva-se-it.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R047',\n level: 'warning',\n message: 'Italian VAT Code (Partita Iva) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0211';\n\nfunction evaluatePeppolCommonR047(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => checkPIVAseIT(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR047 = schematronRule(rule, evaluatePeppolCommonR047);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkSEOrgnr } from '#/peppol-validations/check-se-orgnr.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R049',\n level: 'fatal',\n message: 'Swedish organization number MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0007';\n\nfunction evaluatePeppolCommonR049(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.trim().length === 10 && Number.isFinite(Number(i.id.trim())) && checkSEOrgnr(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR049 = schematronRule(rule, evaluatePeppolCommonR049);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidABN } from '#/peppol-validations/is-valid-abn.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R050',\n level: 'fatal',\n message: 'Australian Business Number (ABN) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0151';\n\nfunction evaluatePeppolCommonR050(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]{11}$/.test(normalizeSpace(i.id)) && isValidABN(normalizeSpace(i.id)));\n return passed;\n}\n\nexport const validatePeppolCommonR050 = schematronRule(rule, evaluatePeppolCommonR050);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R052',\n level: 'warning',\n message: 'Danish chamber of commerce number (P) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0096';\n\nfunction evaluatePeppolCommonR052(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.length === 10 && i.id.replace(/[0-9]/g, '').length === 0);\n return passed;\n}\n\nexport const validatePeppolCommonR052 = schematronRule(rule, evaluatePeppolCommonR052);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R053',\n level: 'warning',\n message: 'Danish ERSTORG number (SE) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0198';\n\nfunction evaluatePeppolCommonR053(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.length === 10 && i.id.startsWith('DK') && i.id.slice(2).replace(/[0-9]/g, '').length === 0);\n return passed;\n}\n\nexport const validatePeppolCommonR053 = schematronRule(rule, evaluatePeppolCommonR053);\n","import { Predicate, Schema } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { PeppolIsoDateString } from '#/schemas/peppol-iso-date-string.ts';\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-F001', level: 'fatal', message: 'A date MUST be formatted YYYY-MM-DD.' } as const satisfies SchematronRule;\n\nconst DATE_REGEX = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst isValidDate = (value: string | undefined): boolean => value === undefined || (DATE_REGEX.test(value) && !Number.isNaN(Date.parse(value)));\n\nconst encodeDateSync = Schema.encodeSync(Schema.Union([PeppolIsoDateString, Schema.String]));\nconst isDate = Schema.is(PeppolIsoDateString);\n\nconst collectDates = (document: PeppolDocument): Array<string> => {\n const optionalDates = [\n document.taxPointDate,\n document.invoicePeriod?.startDate,\n document.invoicePeriod?.endDate,\n document.delivery?.actualDeliveryDate,\n ...getLines(document).flatMap(line => [line.invoicePeriod?.startDate, line.invoicePeriod?.endDate]),\n ].filter((date): date is string => date !== undefined);\n\n const dates = [document.issueDate, ...optionalDates].map(date => encodeDateSync(date));\n if (Predicate.hasProperty(document, 'dueDate') && isDate(document.dueDate)) {\n dates.push(encodeDateSync(document.dueDate));\n }\n return dates;\n};\n\nfunction evaluatePeppolEn16931F001(document: PeppolDocument): boolean {\n return collectDates(document).every(isValidDate);\n}\n\nexport const validatePeppolEn16931F001 = schematronRule(rule, evaluatePeppolEn16931F001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getProfile, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0100',\n level: 'fatal',\n message: 'Invoice type code MUST be set according to the profile.',\n} as const satisfies SchematronRule;\n\nconst PROFILE_01_INVOICE_TYPE_CODES = new Set([\n '71',\n '80',\n '82',\n '84',\n '102',\n '218',\n '219',\n '326',\n '331',\n '380',\n '382',\n '383',\n '384',\n '386',\n '388',\n '393',\n '395',\n '553',\n '575',\n '623',\n '780',\n '817',\n '870',\n '875',\n '876',\n '877',\n]);\n\nfunction evaluatePeppolEn16931P0100(document: PeppolDocument): boolean {\n const invoiceTypeCode = 'invoiceTypeCode' in document ? document.invoiceTypeCode : undefined;\n if (invoiceTypeCode === undefined) {\n return true;\n }\n const profile = getProfile(document);\n if (profile === 'Unknown' || profile !== '01') {\n return true;\n }\n return PROFILE_01_INVOICE_TYPE_CODES.has(invoiceTypeCode);\n}\n\nexport const validatePeppolEn16931P0100 = schematronRule(rule, evaluatePeppolEn16931P0100);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getProfile, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0101',\n level: 'fatal',\n message: 'Credit note type code MUST be set according to the profile.',\n} as const satisfies SchematronRule;\n\nconst PROFILE_01_CREDIT_NOTE_TYPE_CODES = new Set(['381', '396', '81', '83', '532']);\n\nfunction evaluatePeppolEn16931P0101(document: PeppolDocument): boolean {\n const creditNoteTypeCode = 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n if (creditNoteTypeCode === undefined) {\n return true;\n }\n const profile = getProfile(document);\n if (profile === 'Unknown' || profile !== '01') {\n return true;\n }\n return PROFILE_01_CREDIT_NOTE_TYPE_CODES.has(creditNoteTypeCode);\n}\n\nexport const validatePeppolEn16931P0101 = schematronRule(rule, evaluatePeppolEn16931P0101);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0104',\n level: 'fatal',\n message: 'Tax Category G MUST be used when exemption reason code is VATEX-EU-G',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0104(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-G' || category.id === 'G');\n return passed;\n}\n\nexport const validatePeppolEn16931P0104 = schematronRule(rule, evaluatePeppolEn16931P0104);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0105',\n level: 'fatal',\n message: 'Tax Category O MUST be used when exemption reason code is VATEX-EU-O',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0105(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-O' || category.id === 'O');\n return passed;\n}\n\nexport const validatePeppolEn16931P0105 = schematronRule(rule, evaluatePeppolEn16931P0105);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0106',\n level: 'fatal',\n message: 'Tax Category K MUST be used when exemption reason code is VATEX-EU-IC',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0106(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-IC' || category.id === 'K');\n return passed;\n}\n\nexport const validatePeppolEn16931P0106 = schematronRule(rule, evaluatePeppolEn16931P0106);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0107',\n level: 'fatal',\n message: 'Tax Category AE MUST be used when exemption reason code is VATEX-EU-AE',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0107(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-AE' || category.id === 'AE');\n return passed;\n}\n\nexport const validatePeppolEn16931P0107 = schematronRule(rule, evaluatePeppolEn16931P0107);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0108',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-D',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0108(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-D' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0108 = schematronRule(rule, evaluatePeppolEn16931P0108);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0109',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-F',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0109(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-F' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0109 = schematronRule(rule, evaluatePeppolEn16931P0109);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0110',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-I',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0110(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-I' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0110 = schematronRule(rule, evaluatePeppolEn16931P0110);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0111',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-J',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0111(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-J' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0111 = schematronRule(rule, evaluatePeppolEn16931P0111);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isCustomerGermany, isSupplierGermany, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0112',\n level: 'fatal',\n message: 'Invoice type code 326 or 384 are only allowed when both buyer and seller are German organizations ',\n} as const satisfies SchematronRule;\n\nconst GERMAN_ONLY_CODES = new Set(['326', '384']);\n\nfunction evaluatePeppolEn16931P0112(document: PeppolDocument): boolean {\n const invoiceTypeCode = 'invoiceTypeCode' in document ? document.invoiceTypeCode : undefined;\n const creditNoteTypeCode = 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n const code = invoiceTypeCode ?? creditNoteTypeCode;\n if (!code || !GERMAN_ONLY_CODES.has(code)) {\n return true;\n }\n return isSupplierGermany(document) && isCustomerGermany(document);\n}\n\nexport const validatePeppolEn16931P0112 = schematronRule(rule, evaluatePeppolEn16931P0112);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R001', level: 'fatal', message: 'Business process MUST be provided.' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R001(document: PeppolDocument): boolean {\n return typeof document.profileId === 'string' && document.profileId.trim() !== '';\n}\n\nexport const validatePeppolEn16931R001 = schematronRule(rule, evaluatePeppolEn16931R001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R002',\n level: 'fatal',\n message: 'No more than one note is allowed on document level, unless both the buyer and seller are German organizations.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R002(document: PeppolDocument): boolean {\n const noteCount = typeof document.note === 'string' ? 1 : 0;\n return noteCount <= 1;\n}\n\nexport const validatePeppolEn16931R002 = schematronRule(rule, evaluatePeppolEn16931R002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R003',\n level: 'fatal',\n message: 'A buyer reference or purchase order reference MUST be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R003(document: PeppolDocument): boolean {\n const passed = typeof document.buyerReference === 'string' && document.buyerReference.trim() !== '' ? true : Boolean(document.orderReference?.id);\n return passed;\n}\n\nexport const validatePeppolEn16931R003 = schematronRule(rule, evaluatePeppolEn16931R003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R004',\n level: 'fatal',\n message: \"Specification identifier MUST have the value 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0'.\",\n} as const satisfies SchematronRule;\n\nconst CUSTOMIZATION_ID_PREFIX = 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0';\n\nfunction evaluatePeppolEn16931R004(document: PeppolDocument): boolean {\n const customizationId = typeof document.customizationId === 'string' ? document.customizationId.trim() : '';\n return customizationId.startsWith(CUSTOMIZATION_ID_PREFIX);\n}\n\nexport const validatePeppolEn16931R004 = schematronRule(rule, evaluatePeppolEn16931R004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R005',\n level: 'fatal',\n message: 'VAT accounting currency code MUST be different from invoice currency code when provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R005(document: PeppolDocument): boolean {\n if (!document.taxCurrencyCode) {\n return true;\n }\n return document.taxCurrencyCode !== document.documentCurrencyCode;\n}\n\nexport const validatePeppolEn16931R005 = schematronRule(rule, evaluatePeppolEn16931R005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getProfile, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R007',\n level: 'fatal',\n message: \"Business process MUST be in the format 'urn:fdc:peppol.eu:2017:poacc:billing:NN:1.0' where NN indicates the process number.\",\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R007(document: PeppolDocument): boolean {\n return getProfile(document) !== 'Unknown';\n}\n\nexport const validatePeppolEn16931R007 = schematronRule(rule, evaluatePeppolEn16931R007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R008', level: 'fatal', message: 'Document MUST not contain empty elements.' } as const satisfies SchematronRule;\n\nfunction containsEmptyElement(value: unknown): boolean {\n if (value === null || value === undefined) {\n return false;\n }\n if (typeof value === 'string') {\n return value.trim() === '';\n }\n if (Array.isArray(value)) {\n return value.some(containsEmptyElement);\n }\n if (typeof value === 'object') {\n return Object.values(value as Record<string, unknown>).some(containsEmptyElement);\n }\n return false;\n}\n\nfunction evaluatePeppolEn16931R008(document: PeppolDocument): boolean {\n return !containsEmptyElement(document);\n}\n\nexport const validatePeppolEn16931R008 = schematronRule(rule, evaluatePeppolEn16931R008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R010', level: 'fatal', message: 'Buyer electronic address MUST be provided' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R010(document: PeppolDocument): boolean {\n const endpointId = document.accountingCustomerParty.endpointId?.id;\n return typeof endpointId === 'string' && endpointId.trim() !== '';\n}\n\nexport const validatePeppolEn16931R010 = schematronRule(rule, evaluatePeppolEn16931R010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R020', level: 'fatal', message: 'Seller electronic address MUST be provided' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R020(document: PeppolDocument): boolean {\n const endpointId = document.accountingSupplierParty.endpointId?.id;\n return typeof endpointId === 'string' && endpointId.trim() !== '';\n}\n\nexport const validatePeppolEn16931R020 = schematronRule(rule, evaluatePeppolEn16931R020);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule, slack } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R040',\n level: 'fatal',\n message: 'Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R040(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => {\n if (!ac.multiplierFactorNumeric || ac.baseAmount === undefined) {\n return true;\n }\n const expected = (ac.baseAmount * ac.multiplierFactorNumeric) / 100;\n return slack(expected, ac.amount ?? 0, 0.02);\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R040 = schematronRule(rule, evaluatePeppolEn16931R040);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R041',\n level: 'fatal',\n message: 'Allowance/charge base amount MUST be provided when allowance/charge percentage is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R041(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => !ac.multiplierFactorNumeric || ac.baseAmount !== undefined);\n return passed;\n}\n\nexport const validatePeppolEn16931R041 = schematronRule(rule, evaluatePeppolEn16931R041);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R042',\n level: 'fatal',\n message: 'Allowance/charge percentage MUST be provided when allowance/charge base amount is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R042(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => ac.baseAmount === undefined || Boolean(ac.multiplierFactorNumeric));\n return passed;\n}\n\nexport const validatePeppolEn16931R042 = schematronRule(rule, evaluatePeppolEn16931R042);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R043',\n level: 'fatal',\n message: \"Allowance/charge ChargeIndicator value MUST equal 'true' or 'false'\",\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R043(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => typeof ac.chargeIndicator === 'boolean');\n return passed;\n}\n\nexport const validatePeppolEn16931R043 = schematronRule(rule, evaluatePeppolEn16931R043);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R044',\n level: 'fatal',\n message: \"Charge on price level is NOT allowed. Only value 'false' allowed.\",\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R044(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => !line.price.allowanceCharge || !line.price.allowanceCharge.chargeIndicator);\n return passed;\n}\n\nexport const validatePeppolEn16931R044 = schematronRule(rule, evaluatePeppolEn16931R044);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule, slack } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R046',\n level: 'fatal',\n message: 'Item net price MUST equal (Gross price - Allowance amount) when gross price is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R046(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const price = line.price;\n const allowance = price.allowanceCharge;\n if (!allowance || allowance.baseAmount === undefined) {\n return true;\n }\n return slack(allowance.baseAmount.value - (allowance.amount?.value ?? 0), price.priceAmount.value, 0.02);\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R046 = schematronRule(rule, evaluatePeppolEn16931R046);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R051',\n level: 'fatal',\n message:\n 'All currencyID attributes must have the same value as the invoice currency code (BT-5), except for the invoice total VAT amount in accounting currency (BT-111).',\n} as const satisfies SchematronRule;\n\ninterface CurrencyAmount {\n currencyId: string;\n}\n\ninterface AllowanceChargeAmounts {\n amount?: CurrencyAmount | undefined;\n baseAmount?: CurrencyAmount | undefined;\n}\n\nconst matchesCurrency = (amount: CurrencyAmount | undefined, expected: string): boolean => amount?.currencyId === expected;\n\nconst optionalMatchesCurrency = (amount: CurrencyAmount | undefined, expected: string): boolean =>\n amount === undefined || matchesCurrency(amount, expected);\n\nconst allowanceChargeMatchesCurrency = (allowanceCharge: AllowanceChargeAmounts, expected: string): boolean =>\n matchesCurrency(allowanceCharge.amount, expected) && optionalMatchesCurrency(allowanceCharge.baseAmount, expected);\n\nfunction evaluatePeppolEn16931R051(document: PeppolDocument): boolean {\n const currency = document.documentCurrencyCode;\n\n const documentAllowancesOk = (document.allowanceCharges ?? []).every(allowanceCharge => allowanceChargeMatchesCurrency(allowanceCharge, currency));\n\n const linesOk = getLines(document).every(\n line =>\n matchesCurrency(line.price.priceAmount, currency) &&\n matchesCurrency(line.lineExtensionAmount, currency) &&\n (line.allowanceCharges ?? []).every(allowanceCharge => allowanceChargeMatchesCurrency(allowanceCharge, currency))\n );\n\n const taxTotalsOk = document.taxTotals.every(total => {\n // Only tax totals with subtotals are in scope for BT-110; the accounting currency total (BT-111) is excluded.\n if ((total.taxSubtotals?.length ?? 0) === 0) {\n return true;\n }\n return (\n matchesCurrency(total.taxAmount, currency) &&\n (total.taxSubtotals ?? []).every(subtotal => matchesCurrency(subtotal.taxAmount, currency) && matchesCurrency(subtotal.taxableAmount, currency))\n );\n });\n\n const totals = document.legalMonetaryTotal;\n const requiredTotals: Array<CurrencyAmount> = [\n totals.lineExtensionAmount,\n totals.taxExclusiveAmount,\n totals.taxInclusiveAmount,\n totals.payableAmount,\n ];\n const optionalTotals: Array<CurrencyAmount | undefined> = [\n totals.allowanceTotalAmount,\n totals.chargeTotalAmount,\n totals.prepaidAmount,\n totals.payableRoundingAmount,\n ];\n\n const totalsOk =\n requiredTotals.every(amount => matchesCurrency(amount, currency)) && optionalTotals.every(amount => optionalMatchesCurrency(amount, currency));\n\n return documentAllowancesOk && linesOk && taxTotalsOk && totalsOk;\n}\n\nexport const validatePeppolEn16931R051 = schematronRule(rule, evaluatePeppolEn16931R051);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R053',\n level: 'fatal',\n message: 'Only one tax total with tax subtotals MUST be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R053(document: PeppolDocument): boolean {\n const withSubtotals = document.taxTotals.filter(total => (total.taxSubtotals?.length ?? 0) > 0);\n return withSubtotals.length === 1;\n}\n\nexport const validatePeppolEn16931R053 = schematronRule(rule, evaluatePeppolEn16931R053);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R054',\n level: 'fatal',\n message: 'Only one tax total without tax subtotals MUST be provided when tax currency code is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R054(document: PeppolDocument): boolean {\n const withoutSubtotals = document.taxTotals.filter(total => (total.taxSubtotals?.length ?? 0) === 0);\n const expected = document.taxCurrencyCode ? 1 : 0;\n return withoutSubtotals.length === expected;\n}\n\nexport const validatePeppolEn16931R054 = schematronRule(rule, evaluatePeppolEn16931R054);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R055',\n level: 'fatal',\n message: 'Invoice total VAT amount and Invoice total VAT amount in accounting currency MUST have the same operational sign',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R055(document: PeppolDocument): boolean {\n const taxCurrency = document.taxCurrencyCode;\n if (!taxCurrency) {\n return true;\n }\n const documentCurrencyAmount = document.taxTotals.find(total => total.taxAmount.currencyId === document.documentCurrencyCode)?.taxAmount.value;\n const taxCurrencyAmount = document.taxTotals.find(total => total.taxAmount.currencyId === taxCurrency)?.taxAmount.value;\n if (typeof documentCurrencyAmount !== 'number' || typeof taxCurrencyAmount !== 'number') {\n return false;\n }\n const bothNonPositive = documentCurrencyAmount <= 0 && taxCurrencyAmount <= 0;\n const bothNonNegative = documentCurrencyAmount >= 0 && taxCurrencyAmount >= 0;\n return bothNonPositive || bothNonNegative;\n}\n\nexport const validatePeppolEn16931R055 = schematronRule(rule, evaluatePeppolEn16931R055);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R061',\n level: 'fatal',\n message: 'Mandate reference MUST be provided for direct debit.',\n} as const satisfies SchematronRule;\n\nconst DIRECT_DEBIT_CODES = new Set(['49', '59']);\n\nfunction evaluatePeppolEn16931R061(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!DIRECT_DEBIT_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n const mandateId = payment.paymentMandate?.id;\n return typeof mandateId === 'string' && mandateId.trim() !== '';\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R061 = schematronRule(rule, evaluatePeppolEn16931R061);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R100', level: 'fatal', message: 'Only one invoiced object is allowed pr line' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R100(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => (line.documentReference?.length ?? 0) <= 1);\n return passed;\n}\n\nexport const validatePeppolEn16931R100 = schematronRule(rule, evaluatePeppolEn16931R100);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R101',\n level: 'fatal',\n message: 'Element Document reference can only be used for Invoice line object',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R101(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const references = line.documentReference ?? [];\n return references.every(ref => ref.documentTypeCode === '130');\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R101 = schematronRule(rule, evaluatePeppolEn16931R101);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R110',\n level: 'fatal',\n message: 'Start date of line period MUST be within invoice period.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R110(document: PeppolDocument): boolean {\n const invoicePeriodStart = document.invoicePeriod?.startDate;\n if (!invoicePeriodStart) {\n return true;\n }\n const passed = getLines(document).every(line => {\n const lineStart = line.invoicePeriod?.startDate;\n return !lineStart || lineStart >= invoicePeriodStart;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R110 = schematronRule(rule, evaluatePeppolEn16931R110);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R111',\n level: 'fatal',\n message: 'End date of line period MUST be within invoice period.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R111(document: PeppolDocument): boolean {\n const invoicePeriodEnd = document.invoicePeriod?.endDate;\n if (!invoicePeriodEnd) {\n return true;\n }\n const passed = getLines(document).every(line => {\n const lineEnd = line.invoicePeriod?.endDate;\n return !lineEnd || lineEnd <= invoicePeriodEnd;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R111 = schematronRule(rule, evaluatePeppolEn16931R111);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLineQuantity, getLines, schematronRule, slack } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R120',\n level: 'fatal',\n message:\n 'Invoice line net amount MUST equal (Invoiced quantity * (Item net price/item price base quantity) + Sum of invoice line charge amount - sum of invoice line allowance amount',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R120(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const lineExtensionAmount = line.lineExtensionAmount.value;\n const quantity = getLineQuantity(line);\n const priceAmount = line.price.priceAmount.value;\n const baseQuantity = line.price.baseQuantity?.value ?? 1;\n const allowancesTotal = (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const chargesTotal = (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const expected = quantity * (priceAmount / baseQuantity) + chargesTotal - allowancesTotal;\n return slack(expected, lineExtensionAmount, 0.02);\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R120 = schematronRule(rule, evaluatePeppolEn16931R120);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R121',\n level: 'fatal',\n message: 'Base quantity MUST be a positive number above zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R121(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const baseQuantity = line.price.baseQuantity?.value;\n return baseQuantity === undefined || baseQuantity > 0;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R121 = schematronRule(rule, evaluatePeppolEn16931R121);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R130',\n level: 'fatal',\n message: 'Unit code of price base quantity MUST be same as invoiced quantity.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R130(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const baseQuantity = line.price.baseQuantity;\n if (!baseQuantity?.unitCode) {\n return true;\n }\n const quantity = 'invoicedQuantity' in line ? line.invoicedQuantity : 'creditedQuantity' in line ? line.creditedQuantity : undefined;\n if (!quantity) {\n return true;\n }\n return baseQuantity.unitCode === quantity.unitCode;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R130 = schematronRule(rule, evaluatePeppolEn16931R130);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-001',\n level: 'fatal',\n message: 'For Swedish suppliers, Swedish VAT-numbers must consist of 14 characters.',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'VAT')?.companyId;\n return vatCompanyId?.trim().length === 14;\n}\n\nexport const validateSeR001 = schematronRule(rule, evaluateSeR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-002',\n level: 'fatal',\n message: 'For Swedish suppliers, the Swedish VAT-numbers must have the trailing 12 characters in numeric form',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'VAT')?.companyId;\n return vatCompanyId !== undefined && /^\\d{12}$/.test(vatCompanyId.slice(2));\n}\n\nexport const validateSeR002 = schematronRule(rule, evaluateSeR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'SE-R-003', level: 'fatal', message: 'Swedish organisation numbers should be numeric.' } as const satisfies SchematronRule;\n\nfunction evaluateSeR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return companyId === undefined || /^\\d+$/.test(companyId.id);\n}\n\nexport const validateSeR003 = schematronRule(rule, evaluateSeR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'SE-R-004', level: 'fatal', message: 'Swedish organisation numbers consist of 10 characters.' } as const satisfies SchematronRule;\n\nfunction evaluateSeR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return companyId === undefined || companyId.id.trim().length === 10;\n}\n\nexport const validateSeR004 = schematronRule(rule, evaluateSeR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-005',\n level: 'fatal',\n message: \"For Swedish suppliers, when using Seller tax registration identifier, 'Godkänd för F-skatt' must be stated\",\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const nonVatScheme = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id.toUpperCase() !== 'VAT');\n if (!nonVatScheme) {\n return true;\n }\n return nonVatScheme.companyId.trim().toUpperCase() === 'GODKÄND FÖR F-SKATT';\n}\n\nexport const validateSeR005 = schematronRule(rule, evaluateSeR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-006',\n level: 'fatal',\n message: 'For Swedish suppliers, only standard VAT rate of 6, 12 or 25 are used',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_RATES = new Set([6, 12, 25]);\n\nfunction evaluateSeR006(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = getLines(document).every(line => {\n const percent = line.item.classifiedTaxCategory.percent;\n return percent === undefined || ALLOWED_RATES.has(percent);\n });\n return passed;\n}\n\nexport const validateSeR006 = schematronRule(rule, evaluateSeR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-007',\n level: 'warning',\n message: 'For Swedish suppliers using Plusgiro, the Account ID must be numeric ',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR007(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:PLUSGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && /^\\d+$/.test(accountId.trim());\n });\n return passed;\n}\n\nexport const validateSeR007 = schematronRule(rule, evaluateSeR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-008',\n level: 'warning',\n message: 'For Swedish suppliers using Bankgiro, the Account ID must be numeric ',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR008(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:BANKGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && /^\\d+$/.test(accountId.trim());\n });\n return passed;\n}\n\nexport const validateSeR008 = schematronRule(rule, evaluateSeR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-009',\n level: 'warning',\n message: 'For Swedish suppliers using Bankgiro, the Account ID must have 7-8 characters',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR009(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:BANKGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && (accountId.trim().length === 7 || accountId.trim().length === 8);\n });\n return passed;\n}\n\nexport const validateSeR009 = schematronRule(rule, evaluateSeR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-010',\n level: 'warning',\n message: 'For Swedish suppliers using Plusgiro, the Account ID must have 2-8 characters',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR010(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:PLUSGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && accountId.trim().length >= 2 && accountId.trim().length <= 8;\n });\n return passed;\n}\n\nexport const validateSeR010 = schematronRule(rule, evaluateSeR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-011',\n level: 'warning',\n message:\n 'For Swedish suppliers using Swedish Bankgiro or Plusgiro, the proper way to indicate this is to use Code 30 for PaymentMeans and FinancialInstitutionBranch ID with code SE:BANKGIRO or SE:PLUSGIRO',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR011(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n const code = payment.paymentMeansCode.code;\n return code !== '50' && code !== '56';\n });\n return passed;\n}\n\nexport const validateSeR011 = schematronRule(rule, evaluateSeR011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-012',\n level: 'warning',\n message: 'For domestic transactions between Swedish trading partners, credit transfer should be indicated by PaymentMeansCode=\"30\"',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR012(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE' || getCustomerCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => payment.paymentMeansCode.code !== '31');\n return passed;\n}\n\nexport const validateSeR012 = schematronRule(rule, evaluateSeR012);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkSEOrgnr } from '#/peppol-validations/check-se-orgnr.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-013',\n level: 'fatal',\n message: 'The last digit of a Swedish organization number must be valid according to the Luhn algorithm.',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR013(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return companyId === undefined || checkSEOrgnr(companyId.id);\n}\n\nexport const validateSeR013 = schematronRule(rule, evaluateSeR013);\n","import type { SchematronDocumentValidator } from '#/schematron/helpers.ts';\n\nimport { validateCenEn16931BrAe01 } from '#/schematron/cen/ae/cen-en16931-br-ae-01.ts';\nimport { validateCenEn16931BrAe02 } from '#/schematron/cen/ae/cen-en16931-br-ae-02.ts';\nimport { validateCenEn16931BrAe03 } from '#/schematron/cen/ae/cen-en16931-br-ae-03.ts';\nimport { validateCenEn16931BrAe04 } from '#/schematron/cen/ae/cen-en16931-br-ae-04.ts';\nimport { validateCenEn16931BrAe05 } from '#/schematron/cen/ae/cen-en16931-br-ae-05.ts';\nimport { validateCenEn16931BrAe06 } from '#/schematron/cen/ae/cen-en16931-br-ae-06.ts';\nimport { validateCenEn16931BrAe07 } from '#/schematron/cen/ae/cen-en16931-br-ae-07.ts';\nimport { validateCenEn16931BrAe08 } from '#/schematron/cen/ae/cen-en16931-br-ae-08.ts';\nimport { validateCenEn16931BrAe09 } from '#/schematron/cen/ae/cen-en16931-br-ae-09.ts';\nimport { validateCenEn16931BrAe10 } from '#/schematron/cen/ae/cen-en16931-br-ae-10.ts';\nimport { validateCenEn16931BrAf01 } from '#/schematron/cen/af/cen-en16931-br-af-01.ts';\nimport { validateCenEn16931BrAf02 } from '#/schematron/cen/af/cen-en16931-br-af-02.ts';\nimport { validateCenEn16931BrAf03 } from '#/schematron/cen/af/cen-en16931-br-af-03.ts';\nimport { validateCenEn16931BrAf04 } from '#/schematron/cen/af/cen-en16931-br-af-04.ts';\nimport { validateCenEn16931BrAf05 } from '#/schematron/cen/af/cen-en16931-br-af-05.ts';\nimport { validateCenEn16931BrAf06 } from '#/schematron/cen/af/cen-en16931-br-af-06.ts';\nimport { validateCenEn16931BrAf07 } from '#/schematron/cen/af/cen-en16931-br-af-07.ts';\nimport { validateCenEn16931BrAf08 } from '#/schematron/cen/af/cen-en16931-br-af-08.ts';\nimport { validateCenEn16931BrAf09 } from '#/schematron/cen/af/cen-en16931-br-af-09.ts';\nimport { validateCenEn16931BrAf10 } from '#/schematron/cen/af/cen-en16931-br-af-10.ts';\nimport { validateCenEn16931BrAg01 } from '#/schematron/cen/ag/cen-en16931-br-ag-01.ts';\nimport { validateCenEn16931BrAg02 } from '#/schematron/cen/ag/cen-en16931-br-ag-02.ts';\nimport { validateCenEn16931BrAg03 } from '#/schematron/cen/ag/cen-en16931-br-ag-03.ts';\nimport { validateCenEn16931BrAg04 } from '#/schematron/cen/ag/cen-en16931-br-ag-04.ts';\nimport { validateCenEn16931BrAg05 } from '#/schematron/cen/ag/cen-en16931-br-ag-05.ts';\nimport { validateCenEn16931BrAg06 } from '#/schematron/cen/ag/cen-en16931-br-ag-06.ts';\nimport { validateCenEn16931BrAg07 } from '#/schematron/cen/ag/cen-en16931-br-ag-07.ts';\nimport { validateCenEn16931BrAg08 } from '#/schematron/cen/ag/cen-en16931-br-ag-08.ts';\nimport { validateCenEn16931BrAg09 } from '#/schematron/cen/ag/cen-en16931-br-ag-09.ts';\nimport { validateCenEn16931BrAg10 } from '#/schematron/cen/ag/cen-en16931-br-ag-10.ts';\nimport { validateCenEn16931BrB01 } from '#/schematron/cen/b/cen-en16931-br-b-01.ts';\nimport { validateCenEn16931BrB02 } from '#/schematron/cen/b/cen-en16931-br-b-02.ts';\nimport { validateCenEn16931Br01 } from '#/schematron/cen/cen-en16931-br-01.ts';\nimport { validateCenEn16931Br02 } from '#/schematron/cen/cen-en16931-br-02.ts';\nimport { validateCenEn16931Br03 } from '#/schematron/cen/cen-en16931-br-03.ts';\nimport { validateCenEn16931Br04 } from '#/schematron/cen/cen-en16931-br-04.ts';\nimport { validateCenEn16931Br05 } from '#/schematron/cen/cen-en16931-br-05.ts';\nimport { validateCenEn16931Br06 } from '#/schematron/cen/cen-en16931-br-06.ts';\nimport { validateCenEn16931Br07 } from '#/schematron/cen/cen-en16931-br-07.ts';\nimport { validateCenEn16931Br08 } from '#/schematron/cen/cen-en16931-br-08.ts';\nimport { validateCenEn16931Br09 } from '#/schematron/cen/cen-en16931-br-09.ts';\nimport { validateCenEn16931Br10 } from '#/schematron/cen/cen-en16931-br-10.ts';\nimport { validateCenEn16931Br11 } from '#/schematron/cen/cen-en16931-br-11.ts';\nimport { validateCenEn16931Br12 } from '#/schematron/cen/cen-en16931-br-12.ts';\nimport { validateCenEn16931Br13 } from '#/schematron/cen/cen-en16931-br-13.ts';\nimport { validateCenEn16931Br14 } from '#/schematron/cen/cen-en16931-br-14.ts';\nimport { validateCenEn16931Br15 } from '#/schematron/cen/cen-en16931-br-15.ts';\nimport { validateCenEn16931Br16 } from '#/schematron/cen/cen-en16931-br-16.ts';\nimport { validateCenEn16931Br17 } from '#/schematron/cen/cen-en16931-br-17.ts';\nimport { validateCenEn16931Br18 } from '#/schematron/cen/cen-en16931-br-18.ts';\nimport { validateCenEn16931Br19 } from '#/schematron/cen/cen-en16931-br-19.ts';\nimport { validateCenEn16931Br20 } from '#/schematron/cen/cen-en16931-br-20.ts';\nimport { validateCenEn16931Br21 } from '#/schematron/cen/cen-en16931-br-21.ts';\nimport { validateCenEn16931Br22 } from '#/schematron/cen/cen-en16931-br-22.ts';\nimport { validateCenEn16931Br23 } from '#/schematron/cen/cen-en16931-br-23.ts';\nimport { validateCenEn16931Br24 } from '#/schematron/cen/cen-en16931-br-24.ts';\nimport { validateCenEn16931Br25 } from '#/schematron/cen/cen-en16931-br-25.ts';\nimport { validateCenEn16931Br26 } from '#/schematron/cen/cen-en16931-br-26.ts';\nimport { validateCenEn16931Br27 } from '#/schematron/cen/cen-en16931-br-27.ts';\nimport { validateCenEn16931Br28 } from '#/schematron/cen/cen-en16931-br-28.ts';\nimport { validateCenEn16931Br29 } from '#/schematron/cen/cen-en16931-br-29.ts';\nimport { validateCenEn16931Br30 } from '#/schematron/cen/cen-en16931-br-30.ts';\nimport { validateCenEn16931Br31 } from '#/schematron/cen/cen-en16931-br-31.ts';\nimport { validateCenEn16931Br32 } from '#/schematron/cen/cen-en16931-br-32.ts';\nimport { validateCenEn16931Br33 } from '#/schematron/cen/cen-en16931-br-33.ts';\nimport { validateCenEn16931Br36 } from '#/schematron/cen/cen-en16931-br-36.ts';\nimport { validateCenEn16931Br37 } from '#/schematron/cen/cen-en16931-br-37.ts';\nimport { validateCenEn16931Br38 } from '#/schematron/cen/cen-en16931-br-38.ts';\nimport { validateCenEn16931Br41 } from '#/schematron/cen/cen-en16931-br-41.ts';\nimport { validateCenEn16931Br42 } from '#/schematron/cen/cen-en16931-br-42.ts';\nimport { validateCenEn16931Br43 } from '#/schematron/cen/cen-en16931-br-43.ts';\nimport { validateCenEn16931Br44 } from '#/schematron/cen/cen-en16931-br-44.ts';\nimport { validateCenEn16931Br45 } from '#/schematron/cen/cen-en16931-br-45.ts';\nimport { validateCenEn16931Br46 } from '#/schematron/cen/cen-en16931-br-46.ts';\nimport { validateCenEn16931Br47 } from '#/schematron/cen/cen-en16931-br-47.ts';\nimport { validateCenEn16931Br48 } from '#/schematron/cen/cen-en16931-br-48.ts';\nimport { validateCenEn16931Br49 } from '#/schematron/cen/cen-en16931-br-49.ts';\nimport { validateCenEn16931Br50 } from '#/schematron/cen/cen-en16931-br-50.ts';\nimport { validateCenEn16931Br51 } from '#/schematron/cen/cen-en16931-br-51.ts';\nimport { validateCenEn16931Br52 } from '#/schematron/cen/cen-en16931-br-52.ts';\nimport { validateCenEn16931Br53 } from '#/schematron/cen/cen-en16931-br-53.ts';\nimport { validateCenEn16931Br54 } from '#/schematron/cen/cen-en16931-br-54.ts';\nimport { validateCenEn16931Br55 } from '#/schematron/cen/cen-en16931-br-55.ts';\nimport { validateCenEn16931Br56 } from '#/schematron/cen/cen-en16931-br-56.ts';\nimport { validateCenEn16931Br57 } from '#/schematron/cen/cen-en16931-br-57.ts';\nimport { validateCenEn16931Br61 } from '#/schematron/cen/cen-en16931-br-61.ts';\nimport { validateCenEn16931Br62 } from '#/schematron/cen/cen-en16931-br-62.ts';\nimport { validateCenEn16931Br63 } from '#/schematron/cen/cen-en16931-br-63.ts';\nimport { validateCenEn16931Br64 } from '#/schematron/cen/cen-en16931-br-64.ts';\nimport { validateCenEn16931Br65 } from '#/schematron/cen/cen-en16931-br-65.ts';\nimport { validateCenEn16931BrCl08 } from '#/schematron/cen/cl/cen-en16931-br-cl-08.ts';\nimport { validateCenEn16931BrCo03 } from '#/schematron/cen/co/cen-en16931-br-co-03.ts';\nimport { validateCenEn16931BrCo04 } from '#/schematron/cen/co/cen-en16931-br-co-04.ts';\nimport { validateCenEn16931BrCo05 } from '#/schematron/cen/co/cen-en16931-br-co-05.ts';\nimport { validateCenEn16931BrCo06 } from '#/schematron/cen/co/cen-en16931-br-co-06.ts';\nimport { validateCenEn16931BrCo07 } from '#/schematron/cen/co/cen-en16931-br-co-07.ts';\nimport { validateCenEn16931BrCo08 } from '#/schematron/cen/co/cen-en16931-br-co-08.ts';\nimport { validateCenEn16931BrCo09 } from '#/schematron/cen/co/cen-en16931-br-co-09.ts';\nimport { validateCenEn16931BrCo10 } from '#/schematron/cen/co/cen-en16931-br-co-10.ts';\nimport { validateCenEn16931BrCo11 } from '#/schematron/cen/co/cen-en16931-br-co-11.ts';\nimport { validateCenEn16931BrCo12 } from '#/schematron/cen/co/cen-en16931-br-co-12.ts';\nimport { validateCenEn16931BrCo13 } from '#/schematron/cen/co/cen-en16931-br-co-13.ts';\nimport { validateCenEn16931BrCo14 } from '#/schematron/cen/co/cen-en16931-br-co-14.ts';\nimport { validateCenEn16931BrCo15 } from '#/schematron/cen/co/cen-en16931-br-co-15.ts';\nimport { validateCenEn16931BrCo16 } from '#/schematron/cen/co/cen-en16931-br-co-16.ts';\nimport { validateCenEn16931BrCo17 } from '#/schematron/cen/co/cen-en16931-br-co-17.ts';\nimport { validateCenEn16931BrCo18 } from '#/schematron/cen/co/cen-en16931-br-co-18.ts';\nimport { validateCenEn16931BrCo19 } from '#/schematron/cen/co/cen-en16931-br-co-19.ts';\nimport { validateCenEn16931BrCo20 } from '#/schematron/cen/co/cen-en16931-br-co-20.ts';\nimport { validateCenEn16931BrCo21 } from '#/schematron/cen/co/cen-en16931-br-co-21.ts';\nimport { validateCenEn16931BrCo22 } from '#/schematron/cen/co/cen-en16931-br-co-22.ts';\nimport { validateCenEn16931BrCo23 } from '#/schematron/cen/co/cen-en16931-br-co-23.ts';\nimport { validateCenEn16931BrCo24 } from '#/schematron/cen/co/cen-en16931-br-co-24.ts';\nimport { validateCenEn16931BrCo25 } from '#/schematron/cen/co/cen-en16931-br-co-25.ts';\nimport { validateCenEn16931BrCo26 } from '#/schematron/cen/co/cen-en16931-br-co-26.ts';\nimport { validateCenEn16931BrDec01 } from '#/schematron/cen/dec/cen-en16931-br-dec-01.ts';\nimport { validateCenEn16931BrDec02 } from '#/schematron/cen/dec/cen-en16931-br-dec-02.ts';\nimport { validateCenEn16931BrDec05 } from '#/schematron/cen/dec/cen-en16931-br-dec-05.ts';\nimport { validateCenEn16931BrDec06 } from '#/schematron/cen/dec/cen-en16931-br-dec-06.ts';\nimport { validateCenEn16931BrDec09 } from '#/schematron/cen/dec/cen-en16931-br-dec-09.ts';\nimport { validateCenEn16931BrDec10 } from '#/schematron/cen/dec/cen-en16931-br-dec-10.ts';\nimport { validateCenEn16931BrDec11 } from '#/schematron/cen/dec/cen-en16931-br-dec-11.ts';\nimport { validateCenEn16931BrDec12 } from '#/schematron/cen/dec/cen-en16931-br-dec-12.ts';\nimport { validateCenEn16931BrDec13 } from '#/schematron/cen/dec/cen-en16931-br-dec-13.ts';\nimport { validateCenEn16931BrDec14 } from '#/schematron/cen/dec/cen-en16931-br-dec-14.ts';\nimport { validateCenEn16931BrDec15 } from '#/schematron/cen/dec/cen-en16931-br-dec-15.ts';\nimport { validateCenEn16931BrDec16 } from '#/schematron/cen/dec/cen-en16931-br-dec-16.ts';\nimport { validateCenEn16931BrDec17 } from '#/schematron/cen/dec/cen-en16931-br-dec-17.ts';\nimport { validateCenEn16931BrDec18 } from '#/schematron/cen/dec/cen-en16931-br-dec-18.ts';\nimport { validateCenEn16931BrDec19 } from '#/schematron/cen/dec/cen-en16931-br-dec-19.ts';\nimport { validateCenEn16931BrDec20 } from '#/schematron/cen/dec/cen-en16931-br-dec-20.ts';\nimport { validateCenEn16931BrDec23 } from '#/schematron/cen/dec/cen-en16931-br-dec-23.ts';\nimport { validateCenEn16931BrDec24 } from '#/schematron/cen/dec/cen-en16931-br-dec-24.ts';\nimport { validateCenEn16931BrDec25 } from '#/schematron/cen/dec/cen-en16931-br-dec-25.ts';\nimport { validateCenEn16931BrDec27 } from '#/schematron/cen/dec/cen-en16931-br-dec-27.ts';\nimport { validateCenEn16931BrDec28 } from '#/schematron/cen/dec/cen-en16931-br-dec-28.ts';\nimport { validateCenEn16931BrE01 } from '#/schematron/cen/e/cen-en16931-br-e-01.ts';\nimport { validateCenEn16931BrE02 } from '#/schematron/cen/e/cen-en16931-br-e-02.ts';\nimport { validateCenEn16931BrE03 } from '#/schematron/cen/e/cen-en16931-br-e-03.ts';\nimport { validateCenEn16931BrE04 } from '#/schematron/cen/e/cen-en16931-br-e-04.ts';\nimport { validateCenEn16931BrE05 } from '#/schematron/cen/e/cen-en16931-br-e-05.ts';\nimport { validateCenEn16931BrE06 } from '#/schematron/cen/e/cen-en16931-br-e-06.ts';\nimport { validateCenEn16931BrE07 } from '#/schematron/cen/e/cen-en16931-br-e-07.ts';\nimport { validateCenEn16931BrE08 } from '#/schematron/cen/e/cen-en16931-br-e-08.ts';\nimport { validateCenEn16931BrE09 } from '#/schematron/cen/e/cen-en16931-br-e-09.ts';\nimport { validateCenEn16931BrE10 } from '#/schematron/cen/e/cen-en16931-br-e-10.ts';\nimport { validateCenEn16931BrG01 } from '#/schematron/cen/g/cen-en16931-br-g-01.ts';\nimport { validateCenEn16931BrG02 } from '#/schematron/cen/g/cen-en16931-br-g-02.ts';\nimport { validateCenEn16931BrG03 } from '#/schematron/cen/g/cen-en16931-br-g-03.ts';\nimport { validateCenEn16931BrG04 } from '#/schematron/cen/g/cen-en16931-br-g-04.ts';\nimport { validateCenEn16931BrG05 } from '#/schematron/cen/g/cen-en16931-br-g-05.ts';\nimport { validateCenEn16931BrG06 } from '#/schematron/cen/g/cen-en16931-br-g-06.ts';\nimport { validateCenEn16931BrG07 } from '#/schematron/cen/g/cen-en16931-br-g-07.ts';\nimport { validateCenEn16931BrG08 } from '#/schematron/cen/g/cen-en16931-br-g-08.ts';\nimport { validateCenEn16931BrG09 } from '#/schematron/cen/g/cen-en16931-br-g-09.ts';\nimport { validateCenEn16931BrG10 } from '#/schematron/cen/g/cen-en16931-br-g-10.ts';\nimport { validateCenEn16931BrIc01 } from '#/schematron/cen/ic/cen-en16931-br-ic-01.ts';\nimport { validateCenEn16931BrIc02 } from '#/schematron/cen/ic/cen-en16931-br-ic-02.ts';\nimport { validateCenEn16931BrIc03 } from '#/schematron/cen/ic/cen-en16931-br-ic-03.ts';\nimport { validateCenEn16931BrIc04 } from '#/schematron/cen/ic/cen-en16931-br-ic-04.ts';\nimport { validateCenEn16931BrIc05 } from '#/schematron/cen/ic/cen-en16931-br-ic-05.ts';\nimport { validateCenEn16931BrIc06 } from '#/schematron/cen/ic/cen-en16931-br-ic-06.ts';\nimport { validateCenEn16931BrIc07 } from '#/schematron/cen/ic/cen-en16931-br-ic-07.ts';\nimport { validateCenEn16931BrIc08 } from '#/schematron/cen/ic/cen-en16931-br-ic-08.ts';\nimport { validateCenEn16931BrIc09 } from '#/schematron/cen/ic/cen-en16931-br-ic-09.ts';\nimport { validateCenEn16931BrIc10 } from '#/schematron/cen/ic/cen-en16931-br-ic-10.ts';\nimport { validateCenEn16931BrIc11 } from '#/schematron/cen/ic/cen-en16931-br-ic-11.ts';\nimport { validateCenEn16931BrIc12 } from '#/schematron/cen/ic/cen-en16931-br-ic-12.ts';\nimport { validateCenEn16931BrO01 } from '#/schematron/cen/o/cen-en16931-br-o-01.ts';\nimport { validateCenEn16931BrO02 } from '#/schematron/cen/o/cen-en16931-br-o-02.ts';\nimport { validateCenEn16931BrO03 } from '#/schematron/cen/o/cen-en16931-br-o-03.ts';\nimport { validateCenEn16931BrO04 } from '#/schematron/cen/o/cen-en16931-br-o-04.ts';\nimport { validateCenEn16931BrO05 } from '#/schematron/cen/o/cen-en16931-br-o-05.ts';\nimport { validateCenEn16931BrO06 } from '#/schematron/cen/o/cen-en16931-br-o-06.ts';\nimport { validateCenEn16931BrO07 } from '#/schematron/cen/o/cen-en16931-br-o-07.ts';\nimport { validateCenEn16931BrO08 } from '#/schematron/cen/o/cen-en16931-br-o-08.ts';\nimport { validateCenEn16931BrO09 } from '#/schematron/cen/o/cen-en16931-br-o-09.ts';\nimport { validateCenEn16931BrO10 } from '#/schematron/cen/o/cen-en16931-br-o-10.ts';\nimport { validateCenEn16931BrO11 } from '#/schematron/cen/o/cen-en16931-br-o-11.ts';\nimport { validateCenEn16931BrO12 } from '#/schematron/cen/o/cen-en16931-br-o-12.ts';\nimport { validateCenEn16931BrO13 } from '#/schematron/cen/o/cen-en16931-br-o-13.ts';\nimport { validateCenEn16931BrO14 } from '#/schematron/cen/o/cen-en16931-br-o-14.ts';\nimport { validateCenEn16931BrS01 } from '#/schematron/cen/s/cen-en16931-br-s-01.ts';\nimport { validateCenEn16931BrS02 } from '#/schematron/cen/s/cen-en16931-br-s-02.ts';\nimport { validateCenEn16931BrS03 } from '#/schematron/cen/s/cen-en16931-br-s-03.ts';\nimport { validateCenEn16931BrS04 } from '#/schematron/cen/s/cen-en16931-br-s-04.ts';\nimport { validateCenEn16931BrS05 } from '#/schematron/cen/s/cen-en16931-br-s-05.ts';\nimport { validateCenEn16931BrS06 } from '#/schematron/cen/s/cen-en16931-br-s-06.ts';\nimport { validateCenEn16931BrS07 } from '#/schematron/cen/s/cen-en16931-br-s-07.ts';\nimport { validateCenEn16931BrS08 } from '#/schematron/cen/s/cen-en16931-br-s-08.ts';\nimport { validateCenEn16931BrS09 } from '#/schematron/cen/s/cen-en16931-br-s-09.ts';\nimport { validateCenEn16931BrS10 } from '#/schematron/cen/s/cen-en16931-br-s-10.ts';\nimport { validateCenEn16931BrZ01 } from '#/schematron/cen/z/cen-en16931-br-z-01.ts';\nimport { validateCenEn16931BrZ02 } from '#/schematron/cen/z/cen-en16931-br-z-02.ts';\nimport { validateCenEn16931BrZ03 } from '#/schematron/cen/z/cen-en16931-br-z-03.ts';\nimport { validateCenEn16931BrZ04 } from '#/schematron/cen/z/cen-en16931-br-z-04.ts';\nimport { validateCenEn16931BrZ05 } from '#/schematron/cen/z/cen-en16931-br-z-05.ts';\nimport { validateCenEn16931BrZ06 } from '#/schematron/cen/z/cen-en16931-br-z-06.ts';\nimport { validateCenEn16931BrZ07 } from '#/schematron/cen/z/cen-en16931-br-z-07.ts';\nimport { validateCenEn16931BrZ08 } from '#/schematron/cen/z/cen-en16931-br-z-08.ts';\nimport { validateCenEn16931BrZ09 } from '#/schematron/cen/z/cen-en16931-br-z-09.ts';\nimport { validateCenEn16931BrZ10 } from '#/schematron/cen/z/cen-en16931-br-z-10.ts';\nimport { validateDeR001 } from '#/schematron/de/de-r-001.ts';\nimport { validateDeR002 } from '#/schematron/de/de-r-002.ts';\nimport { validateDeR003 } from '#/schematron/de/de-r-003.ts';\nimport { validateDeR004 } from '#/schematron/de/de-r-004.ts';\nimport { validateDeR005 } from '#/schematron/de/de-r-005.ts';\nimport { validateDeR006 } from '#/schematron/de/de-r-006.ts';\nimport { validateDeR007 } from '#/schematron/de/de-r-007.ts';\nimport { validateDeR008 } from '#/schematron/de/de-r-008.ts';\nimport { validateDeR009 } from '#/schematron/de/de-r-009.ts';\nimport { validateDeR010 } from '#/schematron/de/de-r-010.ts';\nimport { validateDeR011 } from '#/schematron/de/de-r-011.ts';\nimport { validateDeR014 } from '#/schematron/de/de-r-014.ts';\nimport { validateDeR015 } from '#/schematron/de/de-r-015.ts';\nimport { validateDeR016 } from '#/schematron/de/de-r-016.ts';\nimport { validateDeR017 } from '#/schematron/de/de-r-017.ts';\nimport { validateDeR018 } from '#/schematron/de/de-r-018.ts';\nimport { validateDeR019 } from '#/schematron/de/de-r-019.ts';\nimport { validateDeR020 } from '#/schematron/de/de-r-020.ts';\nimport { validateDeR022 } from '#/schematron/de/de-r-022.ts';\nimport { validateDeR023_1 } from '#/schematron/de/de-r-023-1.ts';\nimport { validateDeR023_2 } from '#/schematron/de/de-r-023-2.ts';\nimport { validateDeR024_1 } from '#/schematron/de/de-r-024-1.ts';\nimport { validateDeR024_2 } from '#/schematron/de/de-r-024-2.ts';\nimport { validateDeR025_1 } from '#/schematron/de/de-r-025-1.ts';\nimport { validateDeR025_2 } from '#/schematron/de/de-r-025-2.ts';\nimport { validateDeR026 } from '#/schematron/de/de-r-026.ts';\nimport { validateDeR027 } from '#/schematron/de/de-r-027.ts';\nimport { validateDeR028 } from '#/schematron/de/de-r-028.ts';\nimport { validateDeR030 } from '#/schematron/de/de-r-030.ts';\nimport { validateDeR031 } from '#/schematron/de/de-r-031.ts';\nimport { validateDkR002 } from '#/schematron/dk/dk-r-002.ts';\nimport { validateDkR003 } from '#/schematron/dk/dk-r-003.ts';\nimport { validateDkR004 } from '#/schematron/dk/dk-r-004.ts';\nimport { validateDkR005 } from '#/schematron/dk/dk-r-005.ts';\nimport { validateDkR006 } from '#/schematron/dk/dk-r-006.ts';\nimport { validateDkR007 } from '#/schematron/dk/dk-r-007.ts';\nimport { validateDkR008 } from '#/schematron/dk/dk-r-008.ts';\nimport { validateDkR009 } from '#/schematron/dk/dk-r-009.ts';\nimport { validateDkR010 } from '#/schematron/dk/dk-r-010.ts';\nimport { validateDkR011 } from '#/schematron/dk/dk-r-011.ts';\nimport { validateDkR013 } from '#/schematron/dk/dk-r-013.ts';\nimport { validateDkR014 } from '#/schematron/dk/dk-r-014.ts';\nimport { validateDkR016 } from '#/schematron/dk/dk-r-016.ts';\nimport { validateDkR017 } from '#/schematron/dk/dk-r-017.ts';\nimport { validateGrR001_1 } from '#/schematron/gr/gr-r-001-1.ts';\nimport { validateGrR001_2 } from '#/schematron/gr/gr-r-001-2.ts';\nimport { validateGrR001_3 } from '#/schematron/gr/gr-r-001-3.ts';\nimport { validateGrR001_4 } from '#/schematron/gr/gr-r-001-4.ts';\nimport { validateGrR001_5 } from '#/schematron/gr/gr-r-001-5.ts';\nimport { validateGrR001_6 } from '#/schematron/gr/gr-r-001-6.ts';\nimport { validateGrR001_7 } from '#/schematron/gr/gr-r-001-7.ts';\nimport { validateGrR002 } from '#/schematron/gr/gr-r-002.ts';\nimport { validateGrR003 } from '#/schematron/gr/gr-r-003.ts';\nimport { validateGrR004_1 } from '#/schematron/gr/gr-r-004-1.ts';\nimport { validateGrR004_2 } from '#/schematron/gr/gr-r-004-2.ts';\nimport { validateGrR005 } from '#/schematron/gr/gr-r-005.ts';\nimport { validateGrR006 } from '#/schematron/gr/gr-r-006.ts';\nimport { validateGrR008_2 } from '#/schematron/gr/gr-r-008-2.ts';\nimport { validateGrR008_3 } from '#/schematron/gr/gr-r-008-3.ts';\nimport { validateGrR009 } from '#/schematron/gr/gr-r-009.ts';\nimport { validateGrR010 } from '#/schematron/gr/gr-r-010.ts';\nimport { validateGrS008_1 } from '#/schematron/gr/gr-s-008-1.ts';\nimport { validateGrS011 } from '#/schematron/gr/gr-s-011.ts';\nimport { validateIsR001 } from '#/schematron/is/is-r-001.ts';\nimport { validateIsR002 } from '#/schematron/is/is-r-002.ts';\nimport { validateIsR003 } from '#/schematron/is/is-r-003.ts';\nimport { validateIsR004 } from '#/schematron/is/is-r-004.ts';\nimport { validateIsR005 } from '#/schematron/is/is-r-005.ts';\nimport { validateIsR006 } from '#/schematron/is/is-r-006.ts';\nimport { validateIsR007 } from '#/schematron/is/is-r-007.ts';\nimport { validateIsR008 } from '#/schematron/is/is-r-008.ts';\nimport { validateIsR009 } from '#/schematron/is/is-r-009.ts';\nimport { validateIsR010 } from '#/schematron/is/is-r-010.ts';\nimport { validateItR001 } from '#/schematron/it/it-r-001.ts';\nimport { validateItR002 } from '#/schematron/it/it-r-002.ts';\nimport { validateItR003 } from '#/schematron/it/it-r-003.ts';\nimport { validateItR004 } from '#/schematron/it/it-r-004.ts';\nimport { validateNlR001 } from '#/schematron/nl/nl-r-001.ts';\nimport { validateNlR002 } from '#/schematron/nl/nl-r-002.ts';\nimport { validateNlR003 } from '#/schematron/nl/nl-r-003.ts';\nimport { validateNlR004 } from '#/schematron/nl/nl-r-004.ts';\nimport { validateNlR005 } from '#/schematron/nl/nl-r-005.ts';\nimport { validateNlR006 } from '#/schematron/nl/nl-r-006.ts';\nimport { validateNlR007 } from '#/schematron/nl/nl-r-007.ts';\nimport { validateNlR008 } from '#/schematron/nl/nl-r-008.ts';\nimport { validateNlR009 } from '#/schematron/nl/nl-r-009.ts';\nimport { validateNoR001 } from '#/schematron/no/no-r-001.ts';\nimport { validateNoR002 } from '#/schematron/no/no-r-002.ts';\nimport { validatePeppolEn16931CL001 } from '#/schematron/peppol/cl/peppol-en16931-cl001.ts';\nimport { validatePeppolEn16931CL002 } from '#/schematron/peppol/cl/peppol-en16931-cl002.ts';\nimport { validatePeppolEn16931CL003 } from '#/schematron/peppol/cl/peppol-en16931-cl003.ts';\nimport { validatePeppolEn16931CL006 } from '#/schematron/peppol/cl/peppol-en16931-cl006.ts';\nimport { validatePeppolEn16931CL007 } from '#/schematron/peppol/cl/peppol-en16931-cl007.ts';\nimport { validatePeppolEn16931CL008 } from '#/schematron/peppol/cl/peppol-en16931-cl008.ts';\nimport { validatePeppolCommonR040 } from '#/schematron/peppol/common/peppol-common-r040.ts';\nimport { validatePeppolCommonR041 } from '#/schematron/peppol/common/peppol-common-r041.ts';\nimport { validatePeppolCommonR042 } from '#/schematron/peppol/common/peppol-common-r042.ts';\nimport { validatePeppolCommonR043 } from '#/schematron/peppol/common/peppol-common-r043.ts';\nimport { validatePeppolCommonR044 } from '#/schematron/peppol/common/peppol-common-r044.ts';\nimport { validatePeppolCommonR045 } from '#/schematron/peppol/common/peppol-common-r045.ts';\nimport { validatePeppolCommonR046 } from '#/schematron/peppol/common/peppol-common-r046.ts';\nimport { validatePeppolCommonR047 } from '#/schematron/peppol/common/peppol-common-r047.ts';\nimport { validatePeppolCommonR049 } from '#/schematron/peppol/common/peppol-common-r049.ts';\nimport { validatePeppolCommonR050 } from '#/schematron/peppol/common/peppol-common-r050.ts';\nimport { validatePeppolCommonR052 } from '#/schematron/peppol/common/peppol-common-r052.ts';\nimport { validatePeppolCommonR053 } from '#/schematron/peppol/common/peppol-common-r053.ts';\nimport { validatePeppolEn16931F001 } from '#/schematron/peppol/f/peppol-en16931-f001.ts';\nimport { validatePeppolEn16931P0100 } from '#/schematron/peppol/p/peppol-en16931-p0100.ts';\nimport { validatePeppolEn16931P0101 } from '#/schematron/peppol/p/peppol-en16931-p0101.ts';\nimport { validatePeppolEn16931P0104 } from '#/schematron/peppol/p/peppol-en16931-p0104.ts';\nimport { validatePeppolEn16931P0105 } from '#/schematron/peppol/p/peppol-en16931-p0105.ts';\nimport { validatePeppolEn16931P0106 } from '#/schematron/peppol/p/peppol-en16931-p0106.ts';\nimport { validatePeppolEn16931P0107 } from '#/schematron/peppol/p/peppol-en16931-p0107.ts';\nimport { validatePeppolEn16931P0108 } from '#/schematron/peppol/p/peppol-en16931-p0108.ts';\nimport { validatePeppolEn16931P0109 } from '#/schematron/peppol/p/peppol-en16931-p0109.ts';\nimport { validatePeppolEn16931P0110 } from '#/schematron/peppol/p/peppol-en16931-p0110.ts';\nimport { validatePeppolEn16931P0111 } from '#/schematron/peppol/p/peppol-en16931-p0111.ts';\nimport { validatePeppolEn16931P0112 } from '#/schematron/peppol/p/peppol-en16931-p0112.ts';\nimport { validatePeppolEn16931R001 } from '#/schematron/peppol/r/peppol-en16931-r001.ts';\nimport { validatePeppolEn16931R002 } from '#/schematron/peppol/r/peppol-en16931-r002.ts';\nimport { validatePeppolEn16931R003 } from '#/schematron/peppol/r/peppol-en16931-r003.ts';\nimport { validatePeppolEn16931R004 } from '#/schematron/peppol/r/peppol-en16931-r004.ts';\nimport { validatePeppolEn16931R005 } from '#/schematron/peppol/r/peppol-en16931-r005.ts';\nimport { validatePeppolEn16931R007 } from '#/schematron/peppol/r/peppol-en16931-r007.ts';\nimport { validatePeppolEn16931R008 } from '#/schematron/peppol/r/peppol-en16931-r008.ts';\nimport { validatePeppolEn16931R010 } from '#/schematron/peppol/r/peppol-en16931-r010.ts';\nimport { validatePeppolEn16931R020 } from '#/schematron/peppol/r/peppol-en16931-r020.ts';\nimport { validatePeppolEn16931R040 } from '#/schematron/peppol/r/peppol-en16931-r040.ts';\nimport { validatePeppolEn16931R041 } from '#/schematron/peppol/r/peppol-en16931-r041.ts';\nimport { validatePeppolEn16931R042 } from '#/schematron/peppol/r/peppol-en16931-r042.ts';\nimport { validatePeppolEn16931R043 } from '#/schematron/peppol/r/peppol-en16931-r043.ts';\nimport { validatePeppolEn16931R044 } from '#/schematron/peppol/r/peppol-en16931-r044.ts';\nimport { validatePeppolEn16931R046 } from '#/schematron/peppol/r/peppol-en16931-r046.ts';\nimport { validatePeppolEn16931R051 } from '#/schematron/peppol/r/peppol-en16931-r051.ts';\nimport { validatePeppolEn16931R053 } from '#/schematron/peppol/r/peppol-en16931-r053.ts';\nimport { validatePeppolEn16931R054 } from '#/schematron/peppol/r/peppol-en16931-r054.ts';\nimport { validatePeppolEn16931R055 } from '#/schematron/peppol/r/peppol-en16931-r055.ts';\nimport { validatePeppolEn16931R061 } from '#/schematron/peppol/r/peppol-en16931-r061.ts';\nimport { validatePeppolEn16931R100 } from '#/schematron/peppol/r/peppol-en16931-r100.ts';\nimport { validatePeppolEn16931R101 } from '#/schematron/peppol/r/peppol-en16931-r101.ts';\nimport { validatePeppolEn16931R110 } from '#/schematron/peppol/r/peppol-en16931-r110.ts';\nimport { validatePeppolEn16931R111 } from '#/schematron/peppol/r/peppol-en16931-r111.ts';\nimport { validatePeppolEn16931R120 } from '#/schematron/peppol/r/peppol-en16931-r120.ts';\nimport { validatePeppolEn16931R121 } from '#/schematron/peppol/r/peppol-en16931-r121.ts';\nimport { validatePeppolEn16931R130 } from '#/schematron/peppol/r/peppol-en16931-r130.ts';\nimport { validateSeR001 } from '#/schematron/se/se-r-001.ts';\nimport { validateSeR002 } from '#/schematron/se/se-r-002.ts';\nimport { validateSeR003 } from '#/schematron/se/se-r-003.ts';\nimport { validateSeR004 } from '#/schematron/se/se-r-004.ts';\nimport { validateSeR005 } from '#/schematron/se/se-r-005.ts';\nimport { validateSeR006 } from '#/schematron/se/se-r-006.ts';\nimport { validateSeR007 } from '#/schematron/se/se-r-007.ts';\nimport { validateSeR008 } from '#/schematron/se/se-r-008.ts';\nimport { validateSeR009 } from '#/schematron/se/se-r-009.ts';\nimport { validateSeR010 } from '#/schematron/se/se-r-010.ts';\nimport { validateSeR011 } from '#/schematron/se/se-r-011.ts';\nimport { validateSeR012 } from '#/schematron/se/se-r-012.ts';\nimport { validateSeR013 } from '#/schematron/se/se-r-013.ts';\n\nexport const ruleValidators: ReadonlyArray<SchematronDocumentValidator> = [\n validateCenEn16931BrAe01,\n validateCenEn16931BrAe02,\n validateCenEn16931BrAe03,\n validateCenEn16931BrAe04,\n validateCenEn16931BrAe05,\n validateCenEn16931BrAe06,\n validateCenEn16931BrAe07,\n validateCenEn16931BrAe08,\n validateCenEn16931BrAe09,\n validateCenEn16931BrAe10,\n validateCenEn16931BrAf01,\n validateCenEn16931BrAf02,\n validateCenEn16931BrAf03,\n validateCenEn16931BrAf04,\n validateCenEn16931BrAf05,\n validateCenEn16931BrAf06,\n validateCenEn16931BrAf07,\n validateCenEn16931BrAf08,\n validateCenEn16931BrAf09,\n validateCenEn16931BrAf10,\n validateCenEn16931BrAg01,\n validateCenEn16931BrAg02,\n validateCenEn16931BrAg03,\n validateCenEn16931BrAg04,\n validateCenEn16931BrAg05,\n validateCenEn16931BrAg06,\n validateCenEn16931BrAg07,\n validateCenEn16931BrAg08,\n validateCenEn16931BrAg09,\n validateCenEn16931BrAg10,\n validateCenEn16931BrB01,\n validateCenEn16931BrB02,\n validateCenEn16931Br01,\n validateCenEn16931Br02,\n validateCenEn16931Br03,\n validateCenEn16931Br04,\n validateCenEn16931Br05,\n validateCenEn16931Br06,\n validateCenEn16931Br07,\n validateCenEn16931Br08,\n validateCenEn16931Br09,\n validateCenEn16931Br10,\n validateCenEn16931Br11,\n validateCenEn16931Br12,\n validateCenEn16931Br13,\n validateCenEn16931Br14,\n validateCenEn16931Br15,\n validateCenEn16931Br16,\n validateCenEn16931Br17,\n validateCenEn16931Br18,\n validateCenEn16931Br19,\n validateCenEn16931Br20,\n validateCenEn16931Br21,\n validateCenEn16931Br22,\n validateCenEn16931Br23,\n validateCenEn16931Br24,\n validateCenEn16931Br25,\n validateCenEn16931Br26,\n validateCenEn16931Br27,\n validateCenEn16931Br28,\n validateCenEn16931Br29,\n validateCenEn16931Br30,\n validateCenEn16931Br31,\n validateCenEn16931Br32,\n validateCenEn16931Br33,\n validateCenEn16931Br36,\n validateCenEn16931Br37,\n validateCenEn16931Br38,\n validateCenEn16931Br41,\n validateCenEn16931Br42,\n validateCenEn16931Br43,\n validateCenEn16931Br44,\n validateCenEn16931Br45,\n validateCenEn16931Br46,\n validateCenEn16931Br47,\n validateCenEn16931Br48,\n validateCenEn16931Br49,\n validateCenEn16931Br50,\n validateCenEn16931Br51,\n validateCenEn16931Br52,\n validateCenEn16931Br53,\n validateCenEn16931Br54,\n validateCenEn16931Br55,\n validateCenEn16931Br56,\n validateCenEn16931Br57,\n validateCenEn16931Br61,\n validateCenEn16931Br62,\n validateCenEn16931Br63,\n validateCenEn16931Br64,\n validateCenEn16931Br65,\n validateCenEn16931BrCl08,\n validateCenEn16931BrCo03,\n validateCenEn16931BrCo04,\n validateCenEn16931BrCo05,\n validateCenEn16931BrCo06,\n validateCenEn16931BrCo07,\n validateCenEn16931BrCo08,\n validateCenEn16931BrCo09,\n validateCenEn16931BrCo10,\n validateCenEn16931BrCo11,\n validateCenEn16931BrCo12,\n validateCenEn16931BrCo13,\n validateCenEn16931BrCo14,\n validateCenEn16931BrCo15,\n validateCenEn16931BrCo16,\n validateCenEn16931BrCo17,\n validateCenEn16931BrCo18,\n validateCenEn16931BrCo19,\n validateCenEn16931BrCo20,\n validateCenEn16931BrCo21,\n validateCenEn16931BrCo22,\n validateCenEn16931BrCo23,\n validateCenEn16931BrCo24,\n validateCenEn16931BrCo25,\n validateCenEn16931BrCo26,\n validateCenEn16931BrDec01,\n validateCenEn16931BrDec02,\n validateCenEn16931BrDec05,\n validateCenEn16931BrDec06,\n validateCenEn16931BrDec09,\n validateCenEn16931BrDec10,\n validateCenEn16931BrDec11,\n validateCenEn16931BrDec12,\n validateCenEn16931BrDec13,\n validateCenEn16931BrDec14,\n validateCenEn16931BrDec15,\n validateCenEn16931BrDec16,\n validateCenEn16931BrDec17,\n validateCenEn16931BrDec18,\n validateCenEn16931BrDec19,\n validateCenEn16931BrDec20,\n validateCenEn16931BrDec23,\n validateCenEn16931BrDec24,\n validateCenEn16931BrDec25,\n validateCenEn16931BrDec27,\n validateCenEn16931BrDec28,\n validateCenEn16931BrE01,\n validateCenEn16931BrE02,\n validateCenEn16931BrE03,\n validateCenEn16931BrE04,\n validateCenEn16931BrE05,\n validateCenEn16931BrE06,\n validateCenEn16931BrE07,\n validateCenEn16931BrE08,\n validateCenEn16931BrE09,\n validateCenEn16931BrE10,\n validateCenEn16931BrG01,\n validateCenEn16931BrG02,\n validateCenEn16931BrG03,\n validateCenEn16931BrG04,\n validateCenEn16931BrG05,\n validateCenEn16931BrG06,\n validateCenEn16931BrG07,\n validateCenEn16931BrG08,\n validateCenEn16931BrG09,\n validateCenEn16931BrG10,\n validateCenEn16931BrIc01,\n validateCenEn16931BrIc02,\n validateCenEn16931BrIc03,\n validateCenEn16931BrIc04,\n validateCenEn16931BrIc05,\n validateCenEn16931BrIc06,\n validateCenEn16931BrIc07,\n validateCenEn16931BrIc08,\n validateCenEn16931BrIc09,\n validateCenEn16931BrIc10,\n validateCenEn16931BrIc11,\n validateCenEn16931BrIc12,\n validateCenEn16931BrO01,\n validateCenEn16931BrO02,\n validateCenEn16931BrO03,\n validateCenEn16931BrO04,\n validateCenEn16931BrO05,\n validateCenEn16931BrO06,\n validateCenEn16931BrO07,\n validateCenEn16931BrO08,\n validateCenEn16931BrO09,\n validateCenEn16931BrO10,\n validateCenEn16931BrO11,\n validateCenEn16931BrO12,\n validateCenEn16931BrO13,\n validateCenEn16931BrO14,\n validateCenEn16931BrS01,\n validateCenEn16931BrS02,\n validateCenEn16931BrS03,\n validateCenEn16931BrS04,\n validateCenEn16931BrS05,\n validateCenEn16931BrS06,\n validateCenEn16931BrS07,\n validateCenEn16931BrS08,\n validateCenEn16931BrS09,\n validateCenEn16931BrS10,\n validateCenEn16931BrZ01,\n validateCenEn16931BrZ02,\n validateCenEn16931BrZ03,\n validateCenEn16931BrZ04,\n validateCenEn16931BrZ05,\n validateCenEn16931BrZ06,\n validateCenEn16931BrZ07,\n validateCenEn16931BrZ08,\n validateCenEn16931BrZ09,\n validateCenEn16931BrZ10,\n validateDeR001,\n validateDeR002,\n validateDeR003,\n validateDeR004,\n validateDeR005,\n validateDeR006,\n validateDeR007,\n validateDeR008,\n validateDeR009,\n validateDeR010,\n validateDeR011,\n validateDeR014,\n validateDeR015,\n validateDeR016,\n validateDeR017,\n validateDeR018,\n validateDeR019,\n validateDeR020,\n validateDeR022,\n validateDeR023_1,\n validateDeR023_2,\n validateDeR024_1,\n validateDeR024_2,\n validateDeR025_1,\n validateDeR025_2,\n validateDeR026,\n validateDeR027,\n validateDeR028,\n validateDeR030,\n validateDeR031,\n validateDkR002,\n validateDkR003,\n validateDkR004,\n validateDkR005,\n validateDkR006,\n validateDkR007,\n validateDkR008,\n validateDkR009,\n validateDkR010,\n validateDkR011,\n validateDkR013,\n validateDkR014,\n validateDkR016,\n validateDkR017,\n validateGrR001_1,\n validateGrR001_2,\n validateGrR001_3,\n validateGrR001_4,\n validateGrR001_5,\n validateGrR001_6,\n validateGrR001_7,\n validateGrR002,\n validateGrR003,\n validateGrR004_1,\n validateGrR004_2,\n validateGrR005,\n validateGrR006,\n validateGrR008_2,\n validateGrR008_3,\n validateGrR009,\n validateGrR010,\n validateGrS008_1,\n validateGrS011,\n validateIsR001,\n validateIsR002,\n validateIsR003,\n validateIsR004,\n validateIsR005,\n validateIsR006,\n validateIsR007,\n validateIsR008,\n validateIsR009,\n validateIsR010,\n validateItR001,\n validateItR002,\n validateItR003,\n validateItR004,\n validateNlR001,\n validateNlR002,\n validateNlR003,\n validateNlR004,\n validateNlR005,\n validateNlR006,\n validateNlR007,\n validateNlR008,\n validateNlR009,\n validateNoR001,\n validateNoR002,\n validatePeppolEn16931CL001,\n validatePeppolEn16931CL002,\n validatePeppolEn16931CL003,\n validatePeppolEn16931CL006,\n validatePeppolEn16931CL007,\n validatePeppolEn16931CL008,\n validatePeppolCommonR040,\n validatePeppolCommonR041,\n validatePeppolCommonR042,\n validatePeppolCommonR043,\n validatePeppolCommonR044,\n validatePeppolCommonR045,\n validatePeppolCommonR046,\n validatePeppolCommonR047,\n validatePeppolCommonR049,\n validatePeppolCommonR050,\n validatePeppolCommonR052,\n validatePeppolCommonR053,\n validatePeppolEn16931F001,\n validatePeppolEn16931P0100,\n validatePeppolEn16931P0101,\n validatePeppolEn16931P0104,\n validatePeppolEn16931P0105,\n validatePeppolEn16931P0106,\n validatePeppolEn16931P0107,\n validatePeppolEn16931P0108,\n validatePeppolEn16931P0109,\n validatePeppolEn16931P0110,\n validatePeppolEn16931P0111,\n validatePeppolEn16931P0112,\n validatePeppolEn16931R001,\n validatePeppolEn16931R002,\n validatePeppolEn16931R003,\n validatePeppolEn16931R004,\n validatePeppolEn16931R005,\n validatePeppolEn16931R007,\n validatePeppolEn16931R008,\n validatePeppolEn16931R010,\n validatePeppolEn16931R020,\n validatePeppolEn16931R040,\n validatePeppolEn16931R041,\n validatePeppolEn16931R042,\n validatePeppolEn16931R043,\n validatePeppolEn16931R044,\n validatePeppolEn16931R046,\n validatePeppolEn16931R051,\n validatePeppolEn16931R053,\n validatePeppolEn16931R054,\n validatePeppolEn16931R055,\n validatePeppolEn16931R061,\n validatePeppolEn16931R100,\n validatePeppolEn16931R101,\n validatePeppolEn16931R110,\n validatePeppolEn16931R111,\n validatePeppolEn16931R120,\n validatePeppolEn16931R121,\n validatePeppolEn16931R130,\n validateSeR001,\n validateSeR002,\n validateSeR003,\n validateSeR004,\n validateSeR005,\n validateSeR006,\n validateSeR007,\n validateSeR008,\n validateSeR009,\n validateSeR010,\n validateSeR011,\n validateSeR012,\n validateSeR013,\n];\n","import type { Result } from 'effect';\n\nimport { Context, Effect, Layer } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\n\nimport { SchematronValidationError } from '#/schematron/errors.ts';\nimport { ruleValidators } from '#/schematron/run-all-rules.ts';\n\n/**\n * @description The `Schematron` service validates a document against every schematron rule.\n */\nexport interface SchematronShape {\n /**\n * @description Runs every schematron rule against the document, failing with a single `SchematronValidationError` that wraps each failed rule.\n */\n readonly run: (document: PeppolDocument) => Effect.Effect<Result.Result<void, SchematronValidationError>>;\n}\n\n/**\n * @description Runs the schematron rules of this library against a PEPPOL document.\n */\nexport class Schematron extends Context.Service<Schematron, SchematronShape>()('@endevops/peppol-schema/schematron/Schematron') {\n static readonly layer = Layer.effect(\n Schematron,\n Effect.gen(function* () {\n const run = Effect.fn('Schematron.run')(function* (document: PeppolDocument) {\n const [errors] = yield* Effect.partition(ruleValidators, validator => validator(document));\n if (errors.length > 0) {\n return yield* new SchematronValidationError({ errors });\n }\n }, Effect.result);\n return Schematron.of({ run });\n })\n );\n}\n"],"mappings":";;;;;;;;;AAKA,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAAC,uBAAuB;CACxG,IAAI,OAAO;CACX,OAAO,OAAO,SAAS,CAAC,SAAS,SAAS,CAAC;CAC3C,SAAS,OAAO;AAClB,CAAC,CAAC,CAAC,CAAC;;;;AAKJ,IAAa,4BAAb,cAA+C,OAAO,YAAuC,CAAC,CAAC,6BAA6B,EAC1H,QAAQ,OAAO,MAAM,mBAAmB,EAC1C,CAAC,CAAC,CAAC,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P,SAAS;AACX;AAEA,SAAS,eAAe,UAAmC;CACzD,IAAI,mBAAmB,QAAQ,MAAM,MACnC,OAAO;CAET,MAAM,YAAY,SAAS,wBAAwB,iBAAiB;CACpE,OAAO,cAAc,KAAA,KAAa,aAAa,UAAU,EAAE;AAC7D;AAEA,MAAa,iBAAiB,eAAe,MAAM,cAAc;;;ACuVjE,MAAa,iBAA6D;CACxE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AC9rBA,IAAa,aAAb,MAAa,mBAAmB,QAAQ,QAAqC,CAAC,CAAC,+CAA+C,CAAC,CAAC;CAC9H,OAAgB,QAAQ,MAAM,OAC5B,YACA,OAAO,IAAI,aAAa;EACtB,MAAM,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,UAA0B;GAC3E,MAAM,CAAC,UAAU,OAAO,OAAO,UAAU,iBAAgB,cAAa,UAAU,QAAQ,CAAC;GACzF,IAAI,OAAO,SAAS,GAClB,OAAO,OAAO,IAAI,0BAA0B,EAAE,OAAO,CAAC;EAE1D,GAAG,OAAO,MAAM;EAChB,OAAO,WAAW,GAAG,EAAE,IAAI,CAAC;CAC9B,CAAC,CACH;AACF"}
1
+ {"version":3,"file":"schematron.js","names":["rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_CODES","rule","rule","rule","rule","rule","CREDIT_TRANSFER_CODES","rule","rule","CARD_CODES","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_CODES","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","DATE_REGEX","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_CODES","rule","rule","rule","rule","rule","rule","rule","DATE_REGEX","rule","rule","rule","rule","rule","rule","rule","rule","rule","ALLOWED_SCHEMES","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","SCHEME_ID","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule","rule"],"sources":["../src/schematron/errors.ts","../src/schematron/helpers.ts","../src/schematron/cen/ae/cen-en16931-br-ae-01.ts","../src/schematron/cen/ae/cen-en16931-br-ae-02.ts","../src/schematron/cen/ae/cen-en16931-br-ae-03.ts","../src/schematron/cen/ae/cen-en16931-br-ae-04.ts","../src/schematron/cen/ae/cen-en16931-br-ae-05.ts","../src/schematron/cen/ae/cen-en16931-br-ae-06.ts","../src/schematron/cen/ae/cen-en16931-br-ae-07.ts","../src/schematron/cen/ae/cen-en16931-br-ae-08.ts","../src/schematron/cen/ae/cen-en16931-br-ae-09.ts","../src/schematron/cen/ae/cen-en16931-br-ae-10.ts","../src/schematron/cen/af/cen-en16931-br-af-01.ts","../src/schematron/cen/af/cen-en16931-br-af-02.ts","../src/schematron/cen/af/cen-en16931-br-af-03.ts","../src/schematron/cen/af/cen-en16931-br-af-04.ts","../src/schematron/cen/af/cen-en16931-br-af-05.ts","../src/schematron/cen/af/cen-en16931-br-af-06.ts","../src/schematron/cen/af/cen-en16931-br-af-07.ts","../src/schematron/cen/af/cen-en16931-br-af-08.ts","../src/schematron/cen/af/cen-en16931-br-af-09.ts","../src/schematron/cen/af/cen-en16931-br-af-10.ts","../src/schematron/cen/ag/cen-en16931-br-ag-01.ts","../src/schematron/cen/ag/cen-en16931-br-ag-02.ts","../src/schematron/cen/ag/cen-en16931-br-ag-03.ts","../src/schematron/cen/ag/cen-en16931-br-ag-04.ts","../src/schematron/cen/ag/cen-en16931-br-ag-05.ts","../src/schematron/cen/ag/cen-en16931-br-ag-06.ts","../src/schematron/cen/ag/cen-en16931-br-ag-07.ts","../src/schematron/cen/ag/cen-en16931-br-ag-08.ts","../src/schematron/cen/ag/cen-en16931-br-ag-09.ts","../src/schematron/cen/ag/cen-en16931-br-ag-10.ts","../src/schematron/cen/b/cen-en16931-br-b-01.ts","../src/schematron/cen/b/cen-en16931-br-b-02.ts","../src/schematron/cen/cen-en16931-br-01.ts","../src/schematron/cen/cen-en16931-br-02.ts","../src/schematron/cen/cen-en16931-br-03.ts","../src/schematron/cen/cen-en16931-br-04.ts","../src/schematron/cen/cen-en16931-br-05.ts","../src/schematron/cen/cen-en16931-br-06.ts","../src/schematron/cen/cen-en16931-br-07.ts","../src/schematron/cen/cen-en16931-br-08.ts","../src/schematron/cen/cen-en16931-br-09.ts","../src/schematron/cen/cen-en16931-br-10.ts","../src/schematron/cen/cen-en16931-br-11.ts","../src/schematron/cen/cen-en16931-br-12.ts","../src/schematron/cen/cen-en16931-br-13.ts","../src/schematron/cen/cen-en16931-br-14.ts","../src/schematron/cen/cen-en16931-br-15.ts","../src/schematron/cen/cen-en16931-br-16.ts","../src/schematron/cen/cen-en16931-br-17.ts","../src/schematron/cen/cen-en16931-br-18.ts","../src/schematron/cen/cen-en16931-br-19.ts","../src/schematron/cen/cen-en16931-br-20.ts","../src/schematron/cen/cen-en16931-br-21.ts","../src/schematron/cen/cen-en16931-br-22.ts","../src/schematron/cen/cen-en16931-br-23.ts","../src/schematron/cen/cen-en16931-br-24.ts","../src/schematron/cen/cen-en16931-br-25.ts","../src/schematron/cen/cen-en16931-br-26.ts","../src/schematron/cen/cen-en16931-br-27.ts","../src/schematron/cen/cen-en16931-br-28.ts","../src/schematron/cen/cen-en16931-br-29.ts","../src/schematron/cen/cen-en16931-br-30.ts","../src/schematron/cen/cen-en16931-br-31.ts","../src/schematron/cen/cen-en16931-br-32.ts","../src/schematron/cen/cen-en16931-br-33.ts","../src/schematron/cen/cen-en16931-br-36.ts","../src/schematron/cen/cen-en16931-br-37.ts","../src/schematron/cen/cen-en16931-br-38.ts","../src/schematron/cen/cen-en16931-br-41.ts","../src/schematron/cen/cen-en16931-br-42.ts","../src/schematron/cen/cen-en16931-br-43.ts","../src/schematron/cen/cen-en16931-br-44.ts","../src/schematron/cen/cen-en16931-br-45.ts","../src/schematron/cen/cen-en16931-br-46.ts","../src/schematron/cen/cen-en16931-br-47.ts","../src/schematron/cen/cen-en16931-br-48.ts","../src/schematron/cen/cen-en16931-br-49.ts","../src/schematron/cen/cen-en16931-br-50.ts","../src/schematron/cen/cen-en16931-br-51.ts","../src/schematron/cen/cen-en16931-br-52.ts","../src/schematron/cen/cen-en16931-br-53.ts","../src/schematron/cen/cen-en16931-br-54.ts","../src/schematron/cen/cen-en16931-br-55.ts","../src/schematron/cen/cen-en16931-br-56.ts","../src/schematron/cen/cen-en16931-br-57.ts","../src/schematron/cen/cen-en16931-br-61.ts","../src/schematron/cen/cen-en16931-br-62.ts","../src/schematron/cen/cen-en16931-br-63.ts","../src/schematron/cen/cen-en16931-br-64.ts","../src/schematron/cen/cen-en16931-br-65.ts","../src/schematron/cen/cl/cen-en16931-br-cl-08.ts","../src/schematron/cen/co/cen-en16931-br-co-03.ts","../src/schematron/cen/co/cen-en16931-br-co-04.ts","../src/schematron/cen/co/cen-en16931-br-co-05.ts","../src/schematron/cen/co/cen-en16931-br-co-06.ts","../src/schematron/cen/co/cen-en16931-br-co-07.ts","../src/schematron/cen/co/cen-en16931-br-co-08.ts","../src/schematron/cen/co/cen-en16931-br-co-09.ts","../src/schematron/cen/co/cen-en16931-br-co-10.ts","../src/schematron/cen/co/cen-en16931-br-co-11.ts","../src/schematron/cen/co/cen-en16931-br-co-12.ts","../src/schematron/cen/co/cen-en16931-br-co-13.ts","../src/schematron/cen/co/cen-en16931-br-co-14.ts","../src/schematron/cen/co/cen-en16931-br-co-15.ts","../src/schematron/cen/co/cen-en16931-br-co-16.ts","../src/schematron/cen/co/cen-en16931-br-co-17.ts","../src/schematron/cen/co/cen-en16931-br-co-18.ts","../src/schematron/cen/co/cen-en16931-br-co-19.ts","../src/schematron/cen/co/cen-en16931-br-co-20.ts","../src/schematron/cen/co/cen-en16931-br-co-21.ts","../src/schematron/cen/co/cen-en16931-br-co-22.ts","../src/schematron/cen/co/cen-en16931-br-co-23.ts","../src/schematron/cen/co/cen-en16931-br-co-24.ts","../src/schematron/cen/co/cen-en16931-br-co-25.ts","../src/schematron/cen/co/cen-en16931-br-co-26.ts","../src/schematron/cen/dec/cen-en16931-br-dec-01.ts","../src/schematron/cen/dec/cen-en16931-br-dec-02.ts","../src/schematron/cen/dec/cen-en16931-br-dec-05.ts","../src/schematron/cen/dec/cen-en16931-br-dec-06.ts","../src/schematron/cen/dec/cen-en16931-br-dec-09.ts","../src/schematron/cen/dec/cen-en16931-br-dec-10.ts","../src/schematron/cen/dec/cen-en16931-br-dec-11.ts","../src/schematron/cen/dec/cen-en16931-br-dec-12.ts","../src/schematron/cen/dec/cen-en16931-br-dec-13.ts","../src/schematron/cen/dec/cen-en16931-br-dec-14.ts","../src/schematron/cen/dec/cen-en16931-br-dec-15.ts","../src/schematron/cen/dec/cen-en16931-br-dec-16.ts","../src/schematron/cen/dec/cen-en16931-br-dec-17.ts","../src/schematron/cen/dec/cen-en16931-br-dec-18.ts","../src/schematron/cen/dec/cen-en16931-br-dec-19.ts","../src/schematron/cen/dec/cen-en16931-br-dec-20.ts","../src/schematron/cen/dec/cen-en16931-br-dec-23.ts","../src/schematron/cen/dec/cen-en16931-br-dec-24.ts","../src/schematron/cen/dec/cen-en16931-br-dec-25.ts","../src/schematron/cen/dec/cen-en16931-br-dec-27.ts","../src/schematron/cen/dec/cen-en16931-br-dec-28.ts","../src/schematron/cen/e/cen-en16931-br-e-01.ts","../src/schematron/cen/e/cen-en16931-br-e-02.ts","../src/schematron/cen/e/cen-en16931-br-e-03.ts","../src/schematron/cen/e/cen-en16931-br-e-04.ts","../src/schematron/cen/e/cen-en16931-br-e-05.ts","../src/schematron/cen/e/cen-en16931-br-e-06.ts","../src/schematron/cen/e/cen-en16931-br-e-07.ts","../src/schematron/cen/e/cen-en16931-br-e-08.ts","../src/schematron/cen/e/cen-en16931-br-e-09.ts","../src/schematron/cen/e/cen-en16931-br-e-10.ts","../src/schematron/cen/g/cen-en16931-br-g-01.ts","../src/schematron/cen/g/cen-en16931-br-g-02.ts","../src/schematron/cen/g/cen-en16931-br-g-03.ts","../src/schematron/cen/g/cen-en16931-br-g-04.ts","../src/schematron/cen/g/cen-en16931-br-g-05.ts","../src/schematron/cen/g/cen-en16931-br-g-06.ts","../src/schematron/cen/g/cen-en16931-br-g-07.ts","../src/schematron/cen/g/cen-en16931-br-g-08.ts","../src/schematron/cen/g/cen-en16931-br-g-09.ts","../src/schematron/cen/g/cen-en16931-br-g-10.ts","../src/schematron/cen/ic/cen-en16931-br-ic-01.ts","../src/schematron/cen/ic/cen-en16931-br-ic-02.ts","../src/schematron/cen/ic/cen-en16931-br-ic-03.ts","../src/schematron/cen/ic/cen-en16931-br-ic-04.ts","../src/schematron/cen/ic/cen-en16931-br-ic-05.ts","../src/schematron/cen/ic/cen-en16931-br-ic-06.ts","../src/schematron/cen/ic/cen-en16931-br-ic-07.ts","../src/schematron/cen/ic/cen-en16931-br-ic-08.ts","../src/schematron/cen/ic/cen-en16931-br-ic-09.ts","../src/schematron/cen/ic/cen-en16931-br-ic-10.ts","../src/schematron/cen/ic/cen-en16931-br-ic-11.ts","../src/schematron/cen/ic/cen-en16931-br-ic-12.ts","../src/schematron/cen/o/cen-en16931-br-o-01.ts","../src/schematron/cen/o/cen-en16931-br-o-02.ts","../src/schematron/cen/o/cen-en16931-br-o-03.ts","../src/schematron/cen/o/cen-en16931-br-o-04.ts","../src/schematron/cen/o/cen-en16931-br-o-05.ts","../src/schematron/cen/o/cen-en16931-br-o-06.ts","../src/schematron/cen/o/cen-en16931-br-o-07.ts","../src/schematron/cen/o/cen-en16931-br-o-08.ts","../src/schematron/cen/o/cen-en16931-br-o-09.ts","../src/schematron/cen/o/cen-en16931-br-o-10.ts","../src/schematron/cen/o/cen-en16931-br-o-11.ts","../src/schematron/cen/o/cen-en16931-br-o-12.ts","../src/schematron/cen/o/cen-en16931-br-o-13.ts","../src/schematron/cen/o/cen-en16931-br-o-14.ts","../src/schematron/cen/s/cen-en16931-br-s-01.ts","../src/schematron/cen/s/cen-en16931-br-s-02.ts","../src/schematron/cen/s/cen-en16931-br-s-03.ts","../src/schematron/cen/s/cen-en16931-br-s-04.ts","../src/schematron/cen/s/cen-en16931-br-s-05.ts","../src/schematron/cen/s/cen-en16931-br-s-06.ts","../src/schematron/cen/s/cen-en16931-br-s-07.ts","../src/schematron/cen/s/cen-en16931-br-s-08.ts","../src/schematron/cen/s/cen-en16931-br-s-09.ts","../src/schematron/cen/s/cen-en16931-br-s-10.ts","../src/schematron/cen/z/cen-en16931-br-z-01.ts","../src/schematron/cen/z/cen-en16931-br-z-02.ts","../src/schematron/cen/z/cen-en16931-br-z-03.ts","../src/schematron/cen/z/cen-en16931-br-z-04.ts","../src/schematron/cen/z/cen-en16931-br-z-05.ts","../src/schematron/cen/z/cen-en16931-br-z-06.ts","../src/schematron/cen/z/cen-en16931-br-z-07.ts","../src/schematron/cen/z/cen-en16931-br-z-08.ts","../src/schematron/cen/z/cen-en16931-br-z-09.ts","../src/schematron/cen/z/cen-en16931-br-z-10.ts","../src/schematron/de/de-r-001.ts","../src/schematron/de/de-r-002.ts","../src/schematron/de/de-r-003.ts","../src/schematron/de/de-r-004.ts","../src/schematron/de/de-r-005.ts","../src/schematron/de/de-r-006.ts","../src/schematron/de/de-r-007.ts","../src/schematron/de/de-r-008.ts","../src/schematron/de/de-r-009.ts","../src/schematron/de/de-r-010.ts","../src/schematron/de/de-r-011.ts","../src/schematron/de/de-r-014.ts","../src/schematron/de/de-r-015.ts","../src/schematron/de/de-r-016.ts","../src/schematron/de/de-r-017.ts","../src/schematron/de/de-r-018.ts","../src/schematron/de/de-r-019.ts","../src/schematron/de/de-r-020.ts","../src/schematron/de/de-r-022.ts","../src/schematron/de/de-r-023-1.ts","../src/schematron/de/de-r-023-2.ts","../src/schematron/de/de-r-024-1.ts","../src/schematron/de/de-r-024-2.ts","../src/schematron/de/de-r-025-1.ts","../src/schematron/de/de-r-025-2.ts","../src/schematron/de/de-r-026.ts","../src/schematron/de/de-r-027.ts","../src/schematron/de/de-r-028.ts","../src/schematron/de/de-r-030.ts","../src/schematron/de/de-r-031.ts","../src/schematron/dk/dk-r-002.ts","../src/schematron/dk/dk-r-003.ts","../src/schematron/dk/dk-r-004.ts","../src/schematron/dk/dk-r-005.ts","../src/schematron/dk/dk-r-006.ts","../src/schematron/dk/dk-r-007.ts","../src/schematron/dk/dk-r-008.ts","../src/schematron/dk/dk-r-009.ts","../src/schematron/dk/dk-r-010.ts","../src/schematron/dk/dk-r-011.ts","../src/schematron/dk/dk-r-013.ts","../src/schematron/dk/dk-r-014.ts","../src/schematron/dk/dk-r-016.ts","../src/schematron/dk/dk-r-017.ts","../src/schematron/gr/gr-r-001-1.ts","../src/schematron/gr/gr-r-001-2.ts","../src/schematron/gr/gr-r-001-3.ts","../src/schematron/gr/gr-r-001-4.ts","../src/schematron/gr/gr-r-001-5.ts","../src/schematron/gr/gr-r-001-6.ts","../src/schematron/gr/gr-r-001-7.ts","../src/schematron/gr/gr-r-002.ts","../src/schematron/gr/gr-r-003.ts","../src/schematron/gr/gr-r-004-1.ts","../src/schematron/gr/gr-r-004-2.ts","../src/schematron/gr/gr-r-005.ts","../src/schematron/gr/gr-r-006.ts","../src/schematron/gr/gr-r-008-2.ts","../src/schematron/gr/gr-r-008-3.ts","../src/schematron/gr/gr-r-009.ts","../src/schematron/gr/gr-r-010.ts","../src/schematron/gr/gr-s-008-1.ts","../src/schematron/gr/gr-s-011.ts","../src/schematron/is/is-r-001.ts","../src/schematron/is/is-r-002.ts","../src/schematron/is/is-r-003.ts","../src/schematron/is/is-r-004.ts","../src/schematron/is/is-r-005.ts","../src/schematron/is/is-r-006.ts","../src/schematron/is/is-r-007.ts","../src/schematron/is/is-r-008.ts","../src/schematron/is/is-r-009.ts","../src/schematron/is/is-r-010.ts","../src/schematron/it/it-r-001.ts","../src/schematron/it/it-r-002.ts","../src/schematron/it/it-r-003.ts","../src/schematron/it/it-r-004.ts","../src/schematron/nl/nl-r-001.ts","../src/schematron/nl/nl-r-002.ts","../src/schematron/nl/nl-r-003.ts","../src/schematron/nl/nl-r-004.ts","../src/schematron/nl/nl-r-005.ts","../src/schematron/nl/nl-r-006.ts","../src/schematron/nl/nl-r-007.ts","../src/schematron/nl/nl-r-008.ts","../src/schematron/nl/nl-r-009.ts","../src/schematron/no/no-r-001.ts","../src/schematron/no/no-r-002.ts","../src/schematron/peppol/cl/peppol-en16931-cl001.ts","../src/schematron/peppol/cl/peppol-en16931-cl002.ts","../src/schematron/peppol/cl/peppol-en16931-cl003.ts","../src/schematron/peppol/cl/peppol-en16931-cl006.ts","../src/schematron/peppol/cl/peppol-en16931-cl007.ts","../src/schematron/peppol/cl/peppol-en16931-cl008.ts","../src/schematron/peppol/common/peppol-common-r040.ts","../src/schematron/peppol/common/peppol-common-r041.ts","../src/schematron/peppol/common/peppol-common-r042.ts","../src/schematron/peppol/common/peppol-common-r043.ts","../src/schematron/peppol/common/peppol-common-r044.ts","../src/schematron/peppol/common/peppol-common-r045.ts","../src/schematron/peppol/common/peppol-common-r046.ts","../src/schematron/peppol/common/peppol-common-r047.ts","../src/schematron/peppol/common/peppol-common-r049.ts","../src/schematron/peppol/common/peppol-common-r050.ts","../src/schematron/peppol/common/peppol-common-r052.ts","../src/schematron/peppol/common/peppol-common-r053.ts","../src/schematron/peppol/f/peppol-en16931-f001.ts","../src/schematron/peppol/p/peppol-en16931-p0100.ts","../src/schematron/peppol/p/peppol-en16931-p0101.ts","../src/schematron/peppol/p/peppol-en16931-p0104.ts","../src/schematron/peppol/p/peppol-en16931-p0105.ts","../src/schematron/peppol/p/peppol-en16931-p0106.ts","../src/schematron/peppol/p/peppol-en16931-p0107.ts","../src/schematron/peppol/p/peppol-en16931-p0108.ts","../src/schematron/peppol/p/peppol-en16931-p0109.ts","../src/schematron/peppol/p/peppol-en16931-p0110.ts","../src/schematron/peppol/p/peppol-en16931-p0111.ts","../src/schematron/peppol/p/peppol-en16931-p0112.ts","../src/schematron/peppol/r/peppol-en16931-r001.ts","../src/schematron/peppol/r/peppol-en16931-r002.ts","../src/schematron/peppol/r/peppol-en16931-r003.ts","../src/schematron/peppol/r/peppol-en16931-r004.ts","../src/schematron/peppol/r/peppol-en16931-r005.ts","../src/schematron/peppol/r/peppol-en16931-r007.ts","../src/schematron/peppol/r/peppol-en16931-r008.ts","../src/schematron/peppol/r/peppol-en16931-r010.ts","../src/schematron/peppol/r/peppol-en16931-r020.ts","../src/schematron/peppol/r/peppol-en16931-r040.ts","../src/schematron/peppol/r/peppol-en16931-r041.ts","../src/schematron/peppol/r/peppol-en16931-r042.ts","../src/schematron/peppol/r/peppol-en16931-r043.ts","../src/schematron/peppol/r/peppol-en16931-r044.ts","../src/schematron/peppol/r/peppol-en16931-r046.ts","../src/schematron/peppol/r/peppol-en16931-r051.ts","../src/schematron/peppol/r/peppol-en16931-r053.ts","../src/schematron/peppol/r/peppol-en16931-r054.ts","../src/schematron/peppol/r/peppol-en16931-r055.ts","../src/schematron/peppol/r/peppol-en16931-r061.ts","../src/schematron/peppol/r/peppol-en16931-r100.ts","../src/schematron/peppol/r/peppol-en16931-r101.ts","../src/schematron/peppol/r/peppol-en16931-r110.ts","../src/schematron/peppol/r/peppol-en16931-r111.ts","../src/schematron/peppol/r/peppol-en16931-r120.ts","../src/schematron/peppol/r/peppol-en16931-r121.ts","../src/schematron/peppol/r/peppol-en16931-r130.ts","../src/schematron/se/se-r-001.ts","../src/schematron/se/se-r-002.ts","../src/schematron/se/se-r-003.ts","../src/schematron/se/se-r-004.ts","../src/schematron/se/se-r-005.ts","../src/schematron/se/se-r-006.ts","../src/schematron/se/se-r-007.ts","../src/schematron/se/se-r-008.ts","../src/schematron/se/se-r-009.ts","../src/schematron/se/se-r-010.ts","../src/schematron/se/se-r-011.ts","../src/schematron/se/se-r-012.ts","../src/schematron/se/se-r-013.ts","../src/schematron/run-all-rules.ts","../src/schematron/schematron.ts"],"sourcesContent":["import { Schema } from 'effect';\n\n/**\n * @description Failure of a single schematron rule against a document.\n */\nexport class SchematronRuleError extends Schema.TaggedError<SchematronRuleError>()('SchematronRuleError', {\n id: Schema.String,\n level: Schema.Literals(['fatal', 'warning']),\n message: Schema.String,\n}) {}\n\n/**\n * @description Failure of a schematron validation run, wrapping every rule that failed.\n */\nexport class SchematronValidationError extends Schema.TaggedError<SchematronValidationError>()('SchematronValidationError', {\n errors: Schema.Array(SchematronRuleError),\n}) {}\n","import { Effect } from 'effect';\n\nimport type { PeppolInvoicePeriod } from '#/schemas/fields/peppol-invoice-period-schema.ts';\nimport type { PeppolTaxSubTotal } from '#/schemas/fields/peppol-tax-subtotal-schema.ts';\nimport type { PeppolDocument, PeppolDocumentLine } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRuleLevel } from '#/schematron/types.ts';\n\nimport { SchematronRuleError } from '#/schematron/errors.ts';\nimport { chargeReasonCodesKeys } from '#/values/charge-reason-codes.generated';\nimport { countryCodesKeys } from '#/values/country-code.generated';\n\nexport type PeppolLine = PeppolDocumentLine;\n\n/**\n * @description Rule metadata shared by all schematron rules.\n */\nexport interface SchematronRule {\n id: string;\n level: SchematronRuleLevel;\n message: string;\n}\n\n/**\n * @description An effectful schematron rule validator. Fails with a `SchematronRuleError` when the document does not satisfy the rule.\n */\nexport type SchematronDocumentValidator = (document: PeppolDocument) => Effect.Effect<void, SchematronRuleError>;\n\n/**\n * @description Builds an effectful validator from rule metadata and a pure predicate.\n */\nexport function schematronRule(rule: SchematronRule, predicate: (document: PeppolDocument) => boolean): SchematronDocumentValidator {\n return Effect.fn(`schematron.${rule.id}`)(function* (document: PeppolDocument) {\n if (!predicate(document)) {\n return yield* new SchematronRuleError({ id: rule.id, level: rule.level, message: rule.message });\n }\n });\n}\n\n/**\n * @description Rounds a number to 2 decimals, mirroring the schematron `round(x * 10 * 10) div 100`.\n */\nexport function round2(value: number): number {\n return Math.round(value * 100) / 100;\n}\n\n/**\n * @description Checks that `val` is within `slack` of `exp`, mirroring the schematron `u:slack` function.\n */\nexport function slack(exp: number, val: number, tolerance: number): boolean {\n return exp + tolerance >= val && exp - tolerance <= val;\n}\n\n/**\n * @description Extracts the process number from the business process identifier, mirroring the schematron `$profile` variable. Returns `'Unknown'` when the\n * identifier does not match the expected format.\n */\nexport function getProfile(document: Pick<PeppolDocument, 'profileId'>): string {\n const profileId = document.profileId;\n if (typeof profileId === 'string' && /^urn:fdc:peppol.eu:2017:poacc:billing:\\d{2}:1\\.0$/.test(profileId.trim())) {\n return profileId.trim().split(':')[6] ?? 'Unknown';\n }\n return 'Unknown';\n}\n\n/**\n * @description Resolves the supplier country from the VAT identifier prefix or the supplier postal address, mirroring the schematron `$supplierCountry` variable.\n */\nexport function getSupplierCountry(document: PeppolDocument): string {\n const vatScheme = document.accountingSupplierParty.partyTaxSchemes?.find(s => s.taxSchemeId.id === 'VAT');\n const prefix = vatScheme?.companyId?.slice(0, 2);\n if (prefix) {\n return prefix.toUpperCase();\n }\n const taxRep = document.taxRepresentativeParty;\n if (taxRep?.partyTaxScheme.taxSchemeId.id === 'VAT') {\n const taxRepPrefix = taxRep.partyTaxScheme.companyId.slice(0, 2);\n if (taxRepPrefix) {\n return taxRepPrefix.toUpperCase();\n }\n }\n const country = document.accountingSupplierParty.postalAddress.countryCode.identificationCode;\n return country ? country.toUpperCase() : 'XX';\n}\n\n/**\n * @description Resolves the customer country from the VAT identifier prefix or the customer postal address, mirroring the schematron `$customerCountry` variable.\n */\nexport function getCustomerCountry(document: PeppolDocument): string {\n const vatScheme = document.accountingCustomerParty.partyTaxSchemes?.find(s => s.taxSchemeId.id === 'VAT');\n const prefix = vatScheme?.companyId?.slice(0, 2);\n if (prefix) {\n return prefix.toUpperCase();\n }\n const country = document.accountingCustomerParty.postalAddress.countryCode.identificationCode;\n return country ? country.toUpperCase() : 'XX';\n}\n\n/**\n * @description Whether the supplier postal address country is Germany, mirroring the schematron `$supplierCountryIsDE` variable.\n */\nexport function isSupplierGermany(document: PeppolDocument): boolean {\n return document.accountingSupplierParty.postalAddress.countryCode.identificationCode.toUpperCase() === 'DE';\n}\n\n/**\n * @description Whether the customer postal address country is Germany, mirroring the schematron `$customerCountryIsDE` variable.\n */\nexport function isCustomerGermany(document: PeppolDocument): boolean {\n return document.accountingCustomerParty.postalAddress.countryCode.identificationCode.toUpperCase() === 'DE';\n}\n\n/**\n * @description Whether both the supplier and customer countries are Denmark, mirroring the schematron `$supplierCountryIsDK` and `$customerCountryIsDK` variables.\n */\nexport function isDanishSupplierAndCustomer(document: PeppolDocument): boolean {\n return getSupplierCountry(document) === 'DK' && getCustomerCountry(document) === 'DK';\n}\n\n/**\n * @description Whether both the supplier and customer postal address countries are Germany, mirroring the schematron `$supplierCountryIsDE` and\n * `$customerCountryIsDE` variables.\n */\nexport function isGermanSupplierAndCustomer(document: PeppolDocument): boolean {\n return isSupplierGermany(document) && isCustomerGermany(document);\n}\n\n/**\n * @description Returns the invoice lines or credit note lines of a document.\n */\nexport function getLines(document: PeppolDocument): Array<PeppolLine> {\n if ('invoiceLines' in document && Array.isArray(document.invoiceLines)) {\n return document.invoiceLines as Array<PeppolLine>;\n }\n if ('creditNoteLines' in document && Array.isArray(document.creditNoteLines)) {\n return document.creditNoteLines as Array<PeppolLine>;\n }\n return [];\n}\n\n/**\n * @description Returns the line quantity (invoiced or credited quantity) of a line, defaulting to 1.\n */\nexport function getLineQuantity(line: PeppolLine): number {\n const quantity = 'invoicedQuantity' in line ? line.invoicedQuantity : 'creditedQuantity' in line ? line.creditedQuantity : undefined;\n return quantity ? quantity.value : 1;\n}\n\n/**\n * @description Returns all document level and line level allowance/charges of a document.\n */\nexport function getAllAllowanceCharges(\n document: PeppolDocument\n): Array<{\n amount: number | undefined;\n allowanceChargeReason: string | undefined;\n baseAmount: number | undefined;\n chargeIndicator: boolean | undefined;\n multiplierFactorNumeric: number | undefined;\n reasonCode: string | undefined;\n taxCategoryId: string | undefined;\n}> {\n const documentLevel = (document.allowanceCharges ?? []).map(ac => ({\n allowanceChargeReason: ac.allowanceChargeReason,\n amount: ac.amount?.value,\n baseAmount: ac.baseAmount?.value,\n chargeIndicator: ac.chargeIndicator,\n multiplierFactorNumeric: ac.multiplierFactorNumeric,\n reasonCode: ac.allowanceChargeReasonCode,\n taxCategoryId: ac.taxCategory?.id,\n }));\n const lineLevel = getLines(document).flatMap(line =>\n (line.allowanceCharges ?? []).map(ac => ({\n allowanceChargeReason: ac.allowanceChargeReason,\n amount: ac.amount?.value,\n baseAmount: ac.baseAmount?.value,\n chargeIndicator: ac.chargeIndicator,\n multiplierFactorNumeric: ac.multiplierFactorNumeric,\n reasonCode: ac.allowanceChargeReasonCode,\n taxCategoryId: undefined,\n }))\n );\n return [...documentLevel, ...lineLevel];\n}\n\n/**\n * @description Whether a VAT breakdown group (BG-23) contains a VAT category code equal to `code`.\n */\nexport function hasVatBreakdownCode(document: PeppolDocument, code: string): boolean {\n return document.taxTotals.some(t => t.taxSubtotals?.some(s => s.taxCategory.id === code) ?? false);\n}\n\n/**\n * @description Whether the document contains a VAT category code (BT-151, BT-95 or BT-102) equal to `code`.\n */\nexport function hasVatCategoryCode(document: PeppolDocument, code: string): boolean {\n const lineCategories = getLines(document).some(line => line.item.classifiedTaxCategory.id === code);\n const allowanceCharges = (document.allowanceCharges ?? []).some(ac => ac.taxCategory?.id === code);\n return lineCategories || allowanceCharges;\n}\n\n/**\n * @description Resolves the supplier VAT identifier (BT-31) or the seller tax registration identifier (BT-32).\n */\nexport function getSupplierTaxIdentifiers(document: PeppolDocument): string {\n const companyIds = document.accountingSupplierParty.partyTaxSchemes?.map(scheme => scheme.companyId) ?? [];\n const taxRepCompanyId = document.taxRepresentativeParty?.partyTaxScheme.companyId;\n return [taxRepCompanyId, ...companyIds].filter((v): v is string => typeof v === 'string' && v.trim() !== '').join(',');\n}\n\n/**\n * @description Whether the supplier has a VAT identifier (BT-31), a seller tax registration identifier (BT-32) or a tax representative VAT identifier (BT-63).\n */\nexport function hasSellerTaxIdentifier(document: PeppolDocument): boolean {\n return document.accountingSupplierParty.partyTaxSchemes?.some(scheme => scheme.companyId.trim() !== '') ?? false;\n}\n\n/**\n * @description Whether the buyer has a VAT identifier (BT-48) or a legal registration identifier (BT-47).\n */\nexport function hasBuyerTaxIdentifier(document: PeppolDocument): boolean {\n const buyerVat = document.accountingCustomerParty.partyTaxSchemes?.some(scheme => scheme.companyId.trim() !== '') ?? false;\n const buyerLegal =\n typeof document.accountingCustomerParty.partyLegalEntity.companyId?.id === 'string' &&\n document.accountingCustomerParty.partyLegalEntity.companyId?.id.trim() !== '';\n return buyerVat || buyerLegal;\n}\n\n/**\n * @description Whether a number has at most two fraction digits, mirroring the schematron `string-length(substring-after(.,'.'))<=2` checks.\n */\nexport function hasMaxTwoDecimals(value: number): boolean {\n return Math.abs(Math.round(value * 100) / 100 - value) < 1e-9;\n}\n\n/**\n * @description Whether two monetary values are equal, tolerating floating point drift of parsed decimals.\n */\nexport function amountsEqual(a: number, b: number): boolean {\n return Math.abs(a - b) < 1e-9;\n}\n\n/**\n * @description Counts the VAT breakdown groups (BG-23) whose VAT category code (BT-118) equals `code`.\n */\nexport function countVatBreakdownCode(document: PeppolDocument, code: string): number {\n return document.taxTotals.reduce(\n (count, total) => count + (total.taxSubtotals?.filter(subtotal => subtotal.taxCategory.id === code).length ?? 0),\n 0\n );\n}\n\n/**\n * @description Counts the occurrences of a VAT category code (BT-151, BT-95 or BT-102) on invoice lines and document level allowance/charges.\n */\nfunction countVatCategoryCode(document: PeppolDocument, code: string): number {\n const lines = getLines(document).filter(line => line.item.classifiedTaxCategory.id === code).length;\n const allowanceCharges = (document.allowanceCharges ?? []).filter(ac => ac.taxCategory?.id === code).length;\n return lines + allowanceCharges;\n}\n\n/**\n * @description Whether an invoice line (BG-25) carries a VAT category code (BT-151) equal to `code`.\n */\nexport function hasLineVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return getLines(document).some(line => line.item.classifiedTaxCategory.id === code);\n}\n\n/**\n * @description Whether a document level allowance (BG-20) carries a VAT category code (BT-95) equal to `code`.\n */\nexport function hasDocumentAllowanceVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return (document.allowanceCharges ?? []).some(ac => !ac.chargeIndicator && ac.taxCategory?.id === code);\n}\n\n/**\n * @description Whether a document level charge (BG-21) carries a VAT category code (BT-102) equal to `code`.\n */\nexport function hasDocumentChargeVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return (document.allowanceCharges ?? []).some(ac => ac.chargeIndicator && ac.taxCategory?.id === code);\n}\n\n/**\n * @description Whether the supplier has a VAT identifier (BT-31) on a party tax scheme whose tax scheme is \"VAT\".\n */\nexport function hasSellerVatCompanyId(document: PeppolDocument): boolean {\n return (\n document.accountingSupplierParty.partyTaxSchemes?.some(\n scheme => scheme.taxSchemeId.id.toUpperCase() === 'VAT' && scheme.companyId.trim() !== ''\n ) ?? false\n );\n}\n\n/**\n * @description Whether the buyer has a VAT identifier (BT-48) on a party tax scheme whose tax scheme is \"VAT\".\n */\nexport function hasBuyerVatCompanyId(document: PeppolDocument): boolean {\n return (\n document.accountingCustomerParty.partyTaxSchemes?.some(\n scheme => scheme.taxSchemeId.id.toUpperCase() === 'VAT' && scheme.companyId.trim() !== ''\n ) ?? false\n );\n}\n\n/**\n * @description Whether the seller tax representative has a VAT identifier (BT-63) on a \"VAT\" tax scheme.\n */\nexport function hasTaxRepresentativeVatCompanyId(document: PeppolDocument): boolean {\n const taxRepresentative = document.taxRepresentativeParty;\n if (!taxRepresentative) {\n return false;\n }\n return taxRepresentative.partyTaxScheme.taxSchemeId.id.toUpperCase() === 'VAT' && taxRepresentative.partyTaxScheme.companyId.trim() !== '';\n}\n\n/**\n * @description Whether the buyer has a legal registration identifier (BT-47).\n */\nexport function hasBuyerLegalCompanyId(document: PeppolDocument): boolean {\n const id = document.accountingCustomerParty.partyLegalEntity.companyId?.id;\n return typeof id === 'string' && id.trim() !== '';\n}\n\n/**\n * @description Whether every invoice line carrying a VAT category code (BT-151) equal to `code` satisfies `predicate` on its VAT rate (BT-152).\n */\nexport function everyLineCategoryPercent(document: PeppolDocument, code: string, predicate: (percent: number | undefined) => boolean): boolean {\n return getLines(document).every(line => line.item.classifiedTaxCategory.id !== code || predicate(line.item.classifiedTaxCategory.percent));\n}\n\n/**\n * @description Whether every document level allowance carrying a VAT category code (BT-95) equal to `code` satisfies `predicate` on its VAT rate (BT-96).\n */\nexport function everyDocumentAllowanceCategoryPercent(\n document: PeppolDocument,\n code: string,\n predicate: (percent: number | undefined) => boolean\n): boolean {\n return (document.allowanceCharges ?? []).every(ac => ac.chargeIndicator || ac.taxCategory?.id !== code || predicate(ac.taxCategory.percent));\n}\n\n/**\n * @description Whether every document level charge carrying a VAT category code (BT-102) equal to `code` satisfies `predicate` on its VAT rate (BT-103).\n */\nexport function everyDocumentChargeCategoryPercent(\n document: PeppolDocument,\n code: string,\n predicate: (percent: number | undefined) => boolean\n): boolean {\n return (document.allowanceCharges ?? []).every(ac => !ac.chargeIndicator || ac.taxCategory?.id !== code || predicate(ac.taxCategory.percent));\n}\n\n/**\n * @description Sum of invoice line net amounts (BT-131) plus document level charge amounts (BT-99) minus document level allowance amounts (BT-92) where the VAT\n * category codes (BT-151, BT-102, BT-95) equal `code`.\n */\nexport function categoryTaxableSum(document: PeppolDocument, code: string): number {\n const lineSum = getLines(document)\n .filter(line => line.item.classifiedTaxCategory.id === code)\n .reduce((sum, line) => sum + line.lineExtensionAmount.value, 0);\n const chargeSum = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator && ac.taxCategory?.id === code)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const allowanceSum = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator && ac.taxCategory?.id === code)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n return lineSum + chargeSum - allowanceSum;\n}\n\n/**\n * @description Returns the VAT breakdown groups (BG-23) whose VAT category code (BT-118) equals `code`.\n */\nexport function getTaxSubtotalsWithCode(\n document: PeppolDocument,\n code: string\n): Array<{\n taxAmount: number;\n taxableAmount: number;\n taxCategory: { id: string; percent: number | undefined; taxExemptionReason: string | undefined; taxExemptionReasonCode: string | undefined };\n}> {\n return document.taxTotals.flatMap(total =>\n (total.taxSubtotals ?? [])\n .filter(subtotal => subtotal.taxCategory.id === code)\n .map(subtotal => ({\n taxAmount: subtotal.taxAmount.value,\n taxableAmount: subtotal.taxableAmount.value,\n taxCategory: {\n id: subtotal.taxCategory.id,\n percent: subtotal.taxCategory.percent,\n taxExemptionReason: subtotal.taxCategory.taxExemptionReason,\n taxExemptionReasonCode: subtotal.taxCategory.taxExemptionReasonCode,\n },\n }))\n );\n}\n\n/**\n * @description Sum of invoice line net amounts (BT-131) plus document level charge amounts (BT-99) minus document level allowance amounts (BT-92) where the VAT\n * category codes (BT-151, BT-102, BT-95) equal `code` and the VAT rates (BT-152, BT-103, BT-96) equal `rate`.\n */\nfunction categoryTaxableSumAtRate(document: PeppolDocument, code: string, rate: number): number {\n const lineSum = getLines(document)\n .filter(line => line.item.classifiedTaxCategory.id === code && line.item.classifiedTaxCategory.percent === rate)\n .reduce((sum, line) => sum + line.lineExtensionAmount.value, 0);\n const chargeSum = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator && ac.taxCategory?.id === code && ac.taxCategory.percent === rate)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const allowanceSum = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator && ac.taxCategory?.id === code && ac.taxCategory.percent === rate)\n .reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n return lineSum + chargeSum - allowanceSum;\n}\n\n/**\n * @description Whether the seller has a legal registration identifier (BT-30), used by BR-CO-26.\n */\nexport function hasSellerLegalCompanyId(document: PeppolDocument): boolean {\n const id = document.accountingSupplierParty.partyLegalEntity.companyId?.id;\n return typeof id === 'string' && id.trim() !== '';\n}\n\n/**\n * @description Whether every ISO 3166-1 alpha-2 country code present on the document equals `code`, used by BR-B-01.\n */\nexport function everyCountryCodeIs(document: PeppolDocument, code: string): boolean {\n const codes = [\n document.accountingSupplierParty.postalAddress.countryCode.identificationCode,\n document.accountingCustomerParty.postalAddress.countryCode.identificationCode,\n document.taxRepresentativeParty?.postalAddress.countryCode.identificationCode,\n document.delivery?.deliveryLocation?.address?.countryCode.identificationCode,\n ...getLines(document)\n .map(line => line.item.originCountryCode?.identificationCode)\n .filter((v): v is string => typeof v === 'string'),\n ].filter((v): v is string => typeof v === 'string' && v.trim() !== '');\n return codes.every(value => value.toUpperCase() === code);\n}\n\n/**\n * @description Whether every VAT identifier (BT-31, BT-63, BT-48) carries a country prefix from the ISO 3166-1 alpha-2 list (including EL), used by BR-CO-09.\n */\nexport function allVatCompanyIdsHaveValidPrefix(document: PeppolDocument): boolean {\n const companyIds: Array<string> = [];\n const pushVatIds = (schemes: Array<{ companyId: string; taxSchemeId: { id: string } }> | undefined) => {\n for (const scheme of schemes ?? []) {\n if (scheme.taxSchemeId.id.toUpperCase() === 'VAT' && scheme.companyId.trim() !== '') {\n companyIds.push(scheme.companyId.trim());\n }\n }\n };\n pushVatIds(document.accountingSupplierParty.partyTaxSchemes);\n pushVatIds(document.accountingCustomerParty.partyTaxSchemes);\n if (\n document.taxRepresentativeParty?.partyTaxScheme.taxSchemeId.id.toUpperCase() === 'VAT' &&\n document.taxRepresentativeParty.partyTaxScheme.companyId.trim() !== ''\n ) {\n companyIds.push(document.taxRepresentativeParty.partyTaxScheme.companyId.trim());\n }\n return companyIds.every(id => (countryCodesKeys as ReadonlyArray<string>).includes(id.slice(0, 2)));\n}\n\n/**\n * @description Whether every invoice period / line period has an end date after or equal to its start date, used by BR-29 and BR-30.\n */\nexport function everyPeriodEndAfterStart(document: PeppolDocument): boolean {\n const ok = (period: PeppolInvoicePeriod | undefined): boolean => {\n if (!period?.startDate || !period.endDate) {\n return true;\n }\n return period.endDate >= period.startDate;\n };\n const lineOk = getLines(document).every(line => ok(line.invoicePeriod));\n return ok(document.invoicePeriod) && lineOk;\n}\n\n/**\n * @description Whether every invoice period has a start/end date or a description code, used by BR-CO-19 and BR-CO-20.\n */\nexport function everyPeriodHasDateOrDescriptionCode(document: PeppolDocument): boolean {\n const ok = (period: PeppolInvoicePeriod | undefined): boolean => {\n if (!period) {\n return true;\n }\n return typeof period.startDate === 'string' || typeof period.endDate === 'string' || typeof period.descriptionCode === 'string';\n };\n const lineOk = getLines(document).every(line => ok(line.invoicePeriod));\n return ok(document.invoicePeriod) && lineOk;\n}\n\n/**\n * @description Whether the note subject code, when present, is coded using UNTDID 4451, used by BR-CL-08.\n */\nexport function noteSubjectCodeIsUncl4451(document: PeppolDocument): boolean {\n const note = document.note;\n if (typeof note !== 'string' || !note.includes('#')) {\n return true;\n }\n const subject = note.split('#')[1] ?? '';\n if (subject.length !== 3) {\n return true;\n }\n return (chargeReasonCodesKeys as ReadonlyArray<string>).includes(subject);\n}\n\n/**\n * @description Total number of VAT breakdown groups (BG-23) present on the document.\n */\nexport function countAllVatBreakdowns(document: PeppolDocument): number {\n return document.taxTotals.reduce((count, total) => count + (total.taxSubtotals?.length ?? 0), 0);\n}\n\n/**\n * @description Whether the document contains a VAT category code (BT-151, BT-95, BT-102) or a VAT breakdown category code (BT-118) equal to `code`.\n */\nexport function hasAnyVatCategoryCode(document: PeppolDocument, code: string): boolean {\n return countVatCategoryCode(document, code) > 0 || countVatBreakdownCode(document, code) > 0;\n}\n\n/**\n * @description Whether `a` and `b` are within 1 of each other, mirroring the schematron slack used by BR-S-08, BR-AF-08 and BR-AG-08.\n */\nexport function withinSlackOne(a: number, b: number): boolean {\n return Math.abs(a - b) < 1;\n}\n\n/**\n * @description Whether the VAT category tax amount (BT-117) equals the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119), allowing\n * for a slack of 1, mirroring BR-CO-17.\n */\nexport function vatCategoryTaxAmountMatchesRate(subtotal: PeppolTaxSubTotal): boolean {\n const percent = subtotal.taxCategory.percent;\n if (percent === undefined) {\n return Math.round(subtotal.taxAmount.value) === 0;\n }\n if (Math.round(percent) === 0) {\n return Math.round(subtotal.taxAmount.value) === 0;\n }\n const expected = round2(Math.abs(subtotal.taxableAmount.value) * (percent / 100));\n const actual = Math.abs(subtotal.taxAmount.value);\n return withinSlackOne(actual, expected);\n}\n\n/**\n * @description Whether every VAT breakdown (BG-23) whose VAT category code (BT-118) is \"Standard rated\", \"IGIC\" or \"IPSI\" has a VAT category taxable amount\n * (BT-116) that equals the sum of invoice line net amounts (BT-131) plus document level charge amounts (BT-99) minus document level allowance amounts\n * (BT-92) at the same VAT rate, allowing a slack of 1, mirroring BR-S-08, BR-AF-08 and BR-AG-08.\n */\nexport function everyVatBreakdownTaxableMatchesRateSum(document: PeppolDocument): boolean {\n for (const total of document.taxTotals) {\n for (const subtotal of total.taxSubtotals ?? []) {\n const code = subtotal.taxCategory.id;\n if (code !== 'S' && code !== 'L' && code !== 'M') {\n continue;\n }\n const rate = subtotal.taxCategory.percent;\n if (rate === undefined) {\n return false;\n }\n if (!withinSlackOne(subtotal.taxableAmount.value, categoryTaxableSumAtRate(document, code, rate))) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @description Returns all identifiers carrying a scheme identifier, used by the PEPPOL-COMMON-R* rules.\n */\nexport function getIdentifiersWithSchemeId(document: PeppolDocument): Array<{ id: string; schemeId: string }> {\n const candidates: Array<{ id: string | undefined; schemeId: string | undefined }> = [];\n for (const party of [document.accountingSupplierParty, document.accountingCustomerParty]) {\n candidates.push(\n { id: party.endpointId?.id, schemeId: party.endpointId?.schemeId },\n { id: party.partyIdentification?.id?.id, schemeId: party.partyIdentification?.id?.schemeId },\n { id: party.partyLegalEntity.companyId?.id, schemeId: party.partyLegalEntity.companyId?.schemeId }\n );\n }\n const payeeIdentification = document.payeeParty?.partyIdentification?.id;\n if (payeeIdentification) {\n candidates.push({ id: payeeIdentification.id, schemeId: payeeIdentification.schemeId });\n }\n return candidates.filter((candidate): candidate is { id: string; schemeId: string } => Boolean(candidate.id) && Boolean(candidate.schemeId));\n}\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Reverse charge\" shall contain in the VAT Breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"VAT reverse charge\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'AE') || countVatBreakdownCode(document, 'AE') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrAe01 = schematronRule(rule, evaluateCenEn16931BrAe01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerLegalCompanyId,\n hasBuyerVatCompanyId,\n hasLineVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Reverse charge\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) and/or the Buyer legal registration identifier (BT-47).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe02(document: PeppolDocument): boolean {\n const passed =\n !hasLineVatCategoryCode(document, 'AE') ||\n ((hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document)) &&\n (hasBuyerVatCompanyId(document) || hasBuyerLegalCompanyId(document)));\n return passed;\n}\n\nexport const validateCenEn16931BrAe02 = schematronRule(rule, evaluateCenEn16931BrAe02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerLegalCompanyId,\n hasBuyerVatCompanyId,\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Reverse charge\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) and/or the Buyer legal registration identifier (BT-47).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'AE') ||\n ((hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document)) &&\n (hasBuyerVatCompanyId(document) || hasBuyerLegalCompanyId(document)));\n return passed;\n}\n\nexport const validateCenEn16931BrAe03 = schematronRule(rule, evaluateCenEn16931BrAe03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerLegalCompanyId,\n hasBuyerVatCompanyId,\n hasDocumentChargeVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Reverse charge\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) and/or the Buyer legal registration identifier (BT-47).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe04(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentChargeVatCategoryCode(document, 'AE') ||\n ((hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document)) &&\n (hasBuyerVatCompanyId(document) || hasBuyerLegalCompanyId(document)));\n return passed;\n}\n\nexport const validateCenEn16931BrAe04 = schematronRule(rule, evaluateCenEn16931BrAe04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Reverse charge\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'AE', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe05 = schematronRule(rule, evaluateCenEn16931BrAe05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Reverse charge\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'AE', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe06 = schematronRule(rule, evaluateCenEn16931BrAe06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Reverse charge\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'AE', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe07 = schematronRule(rule, evaluateCenEn16931BrAe07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Reverse charge\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Reverse charge\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'AE').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'AE')));\n return passed;\n}\n\nexport const validateCenEn16931BrAe08 = schematronRule(rule, evaluateCenEn16931BrAe08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Reverse charge\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'AE').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAe09 = schematronRule(rule, evaluateCenEn16931BrAe09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AE-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Reverse charge\" shall have a VAT exemption reason code (BT-121), meaning \"Reverse charge\" or the VAT exemption reason text (BT-120) \"Reverse charge\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAe10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'AE').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAe10 = schematronRule(rule, evaluateCenEn16931BrAe10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IGIC\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IGIC\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'L') || countVatBreakdownCode(document, 'L') > 0;\n return passed;\n}\n\nexport const validateCenEn16931BrAf01 = schematronRule(rule, evaluateCenEn16931BrAf01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'L') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf02 = schematronRule(rule, evaluateCenEn16931BrAf02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'L') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf03 = schematronRule(rule, evaluateCenEn16931BrAf03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'L') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf04 = schematronRule(rule, evaluateCenEn16931BrAf04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" the invoiced item VAT rate (BT-152) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'L', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAf05 = schematronRule(rule, evaluateCenEn16931BrAf05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'L', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAf06 = schematronRule(rule, evaluateCenEn16931BrAf06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'L', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAf07 = schematronRule(rule, evaluateCenEn16931BrAf07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyVatBreakdownTaxableMatchesRateSum, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-08',\n level: 'fatal',\n message:\n 'For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IGIC\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IGIC\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf08(document: PeppolDocument): boolean {\n const passed = everyVatBreakdownTaxableMatchesRateSum(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAf08 = schematronRule(rule, evaluateCenEn16931BrAf08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, round2, schematronRule, withinSlackOne } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IGIC\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'L').every(st =>\n withinSlackOne(st.taxAmount, round2((st.taxableAmount * (st.taxCategory.percent ?? 0)) / 100))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAf09 = schematronRule(rule, evaluateCenEn16931BrAf09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AF-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"IGIC\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAf10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'L').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAf10 = schematronRule(rule, evaluateCenEn16931BrAf10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IPSI\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IPSI\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'M') || countVatBreakdownCode(document, 'M') > 0;\n return passed;\n}\n\nexport const validateCenEn16931BrAg01 = schematronRule(rule, evaluateCenEn16931BrAg01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'M') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg02 = schematronRule(rule, evaluateCenEn16931BrAg02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'M') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg03 = schematronRule(rule, evaluateCenEn16931BrAg03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'M') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg04 = schematronRule(rule, evaluateCenEn16931BrAg04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" the Invoiced item VAT rate (BT-152) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'M', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAg05 = schematronRule(rule, evaluateCenEn16931BrAg05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'M', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAg06 = schematronRule(rule, evaluateCenEn16931BrAg06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'M', percent => percent !== undefined && percent >= 0);\n return passed;\n}\n\nexport const validateCenEn16931BrAg07 = schematronRule(rule, evaluateCenEn16931BrAg07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyVatBreakdownTaxableMatchesRateSum, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-08',\n level: 'fatal',\n message:\n 'For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IPSI\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IPSI\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg08(document: PeppolDocument): boolean {\n const passed = everyVatBreakdownTaxableMatchesRateSum(document);\n return passed;\n}\n\nexport const validateCenEn16931BrAg08 = schematronRule(rule, evaluateCenEn16931BrAg08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, round2, schematronRule, withinSlackOne } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IPSI\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'M').every(st =>\n withinSlackOne(st.taxAmount, round2((st.taxableAmount * (st.taxCategory.percent ?? 0)) / 100))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAg09 = schematronRule(rule, evaluateCenEn16931BrAg09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-AG-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"IPSI\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrAg10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'M').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrAg10 = schematronRule(rule, evaluateCenEn16931BrAg10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyCountryCodeIs, hasVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-B-01',\n level: 'fatal',\n message: 'An Invoice where the VAT category code (BT-151, BT-95 or BT-102) is “Split payment” shall be a domestic Italian invoice.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrB01(document: PeppolDocument): boolean {\n const passed = !hasVatCategoryCode(document, 'B') || everyCountryCodeIs(document, 'IT');\n return passed;\n}\n\nexport const validateCenEn16931BrB01 = schematronRule(rule, evaluateCenEn16931BrB01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-B-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is “Split payment\" shall not contain an invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is “Standard rated”.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrB02(document: PeppolDocument): boolean {\n const passed = !hasVatCategoryCode(document, 'B') || !hasVatCategoryCode(document, 'S');\n return passed;\n}\n\nexport const validateCenEn16931BrB02 = schematronRule(rule, evaluateCenEn16931BrB02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-01',\n level: 'fatal',\n message: 'An Invoice shall have a Specification identifier (BT-24).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br01(document: PeppolDocument): boolean {\n const passed = typeof document.customizationId === 'string' && document.customizationId.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br01 = schematronRule(rule, evaluateCenEn16931Br01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-02',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice number (BT-1).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br02(document: PeppolDocument): boolean {\n const passed = typeof document.id === 'string' && document.id.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br02 = schematronRule(rule, evaluateCenEn16931Br02);\n","import { Predicate } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-03',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice issue date (BT-2).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br03(document: PeppolDocument): boolean {\n const passed = Predicate.hasProperty(document, 'issueDate') && Predicate.isTruthy(document.issueDate);\n return passed;\n}\n\nexport const validateCenEn16931Br03 = schematronRule(rule, evaluateCenEn16931Br03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-04',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice type code (BT-3).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br04(document: PeppolDocument): boolean {\n const passed =\n (typeof document.invoiceTypeCode === 'string' && document.invoiceTypeCode.trim() !== '') ||\n (typeof document.creditNoteTypeCode === 'string' && document.creditNoteTypeCode.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br04 = schematronRule(rule, evaluateCenEn16931Br04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-05',\n level: 'fatal',\n message: 'An Invoice shall have an Invoice currency code (BT-5).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br05(document: PeppolDocument): boolean {\n const passed = typeof document.documentCurrencyCode === 'string' && document.documentCurrencyCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br05 = schematronRule(rule, evaluateCenEn16931Br05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-06',\n level: 'fatal',\n message: 'An Invoice shall contain the Seller name (BT-27).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br06(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingSupplierParty.partyLegalEntity.registrationName === 'string' &&\n document.accountingSupplierParty.partyLegalEntity.registrationName.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br06 = schematronRule(rule, evaluateCenEn16931Br06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-07',\n level: 'fatal',\n message: 'An Invoice shall contain the Buyer name (BT-44).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br07(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingCustomerParty.partyLegalEntity.registrationName === 'string' &&\n document.accountingCustomerParty.partyLegalEntity.registrationName.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br07 = schematronRule(rule, evaluateCenEn16931Br07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-08',\n level: 'fatal',\n message: 'An Invoice shall contain the Seller postal address.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br08(document: PeppolDocument): boolean {\n const passed = typeof document.accountingSupplierParty.postalAddress === 'object' && document.accountingSupplierParty.postalAddress !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br08 = schematronRule(rule, evaluateCenEn16931Br08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-09',\n level: 'fatal',\n message: 'The Seller postal address (BG-5) shall contain a Seller country code (BT-40).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br09(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingSupplierParty.postalAddress.countryCode.identificationCode === 'string' &&\n document.accountingSupplierParty.postalAddress.countryCode.identificationCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br09 = schematronRule(rule, evaluateCenEn16931Br09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-10',\n level: 'fatal',\n message: 'An Invoice shall contain the Buyer postal address (BG-8).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br10(document: PeppolDocument): boolean {\n const passed = typeof document.accountingCustomerParty.postalAddress === 'object' && document.accountingCustomerParty.postalAddress !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br10 = schematronRule(rule, evaluateCenEn16931Br10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-11',\n level: 'fatal',\n message: 'The Buyer postal address shall contain a Buyer country code (BT-55).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br11(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingCustomerParty.postalAddress.countryCode.identificationCode === 'string' &&\n document.accountingCustomerParty.postalAddress.countryCode.identificationCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br11 = schematronRule(rule, evaluateCenEn16931Br11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-12',\n level: 'fatal',\n message: 'An Invoice shall have the Sum of Invoice line net amount (BT-106).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br12(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.lineExtensionAmount === 'object' && document.legalMonetaryTotal.lineExtensionAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br12 = schematronRule(rule, evaluateCenEn16931Br12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-13',\n level: 'fatal',\n message: 'An Invoice shall have the Invoice total amount without VAT (BT-109).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br13(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.taxExclusiveAmount === 'object' && document.legalMonetaryTotal.taxExclusiveAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br13 = schematronRule(rule, evaluateCenEn16931Br13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-14',\n level: 'fatal',\n message: 'An Invoice shall have the Invoice total amount with VAT (BT-112).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br14(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.taxInclusiveAmount === 'object' && document.legalMonetaryTotal.taxInclusiveAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br14 = schematronRule(rule, evaluateCenEn16931Br14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-15',\n level: 'fatal',\n message: 'An Invoice shall have the Amount due for payment (BT-115).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br15(document: PeppolDocument): boolean {\n const passed = typeof document.legalMonetaryTotal.payableAmount === 'object' && document.legalMonetaryTotal.payableAmount !== null;\n return passed;\n}\n\nexport const validateCenEn16931Br15 = schematronRule(rule, evaluateCenEn16931Br15);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-16',\n level: 'fatal',\n message: 'An Invoice shall have at least one Invoice line (BG-25)',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br16(document: PeppolDocument): boolean {\n const passed = getLines(document).length > 0;\n return passed;\n}\n\nexport const validateCenEn16931Br16 = schematronRule(rule, evaluateCenEn16931Br16);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-17',\n level: 'fatal',\n message: 'The Payee name (BT-59) shall be provided in the Invoice, if the Payee (BG-10) is different from the Seller (BG-4)',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br17(document: PeppolDocument): boolean {\n const passed =\n !document.payeeParty ||\n (typeof document.payeeParty.partyName.name === 'string' &&\n document.payeeParty.partyName.name.trim() !== '' &&\n document.payeeParty.partyName.name !== document.accountingSupplierParty.partyLegalEntity.registrationName &&\n (document.payeeParty.partyIdentification?.id?.id === undefined ||\n document.payeeParty.partyIdentification.id.id !== document.accountingSupplierParty.partyIdentification?.id?.id));\n return passed;\n}\n\nexport const validateCenEn16931Br17 = schematronRule(rule, evaluateCenEn16931Br17);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-18',\n level: 'fatal',\n message:\n 'The Seller tax representative name (BT-62) shall be provided in the Invoice, if the Seller (BG-4) has a Seller tax representative party (BG-11)',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br18(document: PeppolDocument): boolean {\n const passed =\n !document.taxRepresentativeParty ||\n (typeof document.taxRepresentativeParty.name === 'string' && document.taxRepresentativeParty.name.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br18 = schematronRule(rule, evaluateCenEn16931Br18);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-19',\n level: 'fatal',\n message:\n 'The Seller tax representative postal address (BG-12) shall be provided in the Invoice, if the Seller (BG-4) has a Seller tax representative party (BG-11).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br19(document: PeppolDocument): boolean {\n const passed =\n !document.taxRepresentativeParty ||\n (typeof document.taxRepresentativeParty.postalAddress === 'object' && document.taxRepresentativeParty.postalAddress !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br19 = schematronRule(rule, evaluateCenEn16931Br19);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-20',\n level: 'fatal',\n message:\n 'The Seller tax representative postal address (BG-12) shall contain a Tax representative country code (BT-69), if the Seller (BG-4) has a Seller tax representative party (BG-11).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br20(document: PeppolDocument): boolean {\n const passed =\n !document.taxRepresentativeParty ||\n (typeof document.taxRepresentativeParty.postalAddress.countryCode.identificationCode === 'string' &&\n document.taxRepresentativeParty.postalAddress.countryCode.identificationCode.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br20 = schematronRule(rule, evaluateCenEn16931Br20);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-21',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall have an Invoice line identifier (BT-126).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br21(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.id === 'string' && line.id.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br21 = schematronRule(rule, evaluateCenEn16931Br21);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-22',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall have an Invoiced quantity (BT-129).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br22(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => ('invoicedQuantity' in line ? line.invoicedQuantity : line.creditedQuantity) !== undefined);\n return passed;\n}\n\nexport const validateCenEn16931Br22 = schematronRule(rule, evaluateCenEn16931Br22);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-23',\n level: 'fatal',\n message: 'An Invoice line (BG-25) shall have an Invoiced quantity unit of measure code (BT-130).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br23(document: PeppolDocument): boolean {\n const passed = getLines(document).every(\n line => ('invoicedQuantity' in line ? line.invoicedQuantity : line.creditedQuantity)?.unitCode !== undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931Br23 = schematronRule(rule, evaluateCenEn16931Br23);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-24',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall have an Invoice line net amount (BT-131).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br24(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.lineExtensionAmount === 'object' && line.lineExtensionAmount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br24 = schematronRule(rule, evaluateCenEn16931Br24);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-25',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall contain the Item name (BT-153).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br25(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.item.name === 'string' && line.item.name.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br25 = schematronRule(rule, evaluateCenEn16931Br25);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-26',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall contain the Item net price (BT-146).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br26(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => typeof line.price.priceAmount === 'object' && line.price.priceAmount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br26 = schematronRule(rule, evaluateCenEn16931Br26);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-27',\n level: 'fatal',\n message: 'The Item net price (BT-146) shall NOT be negative.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br27(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => line.price.priceAmount.value >= 0);\n return passed;\n}\n\nexport const validateCenEn16931Br27 = schematronRule(rule, evaluateCenEn16931Br27);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-28',\n level: 'fatal',\n message: 'The Item gross price (BT-148) shall NOT be negative.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br28(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => !line.price.allowanceCharge?.baseAmount || line.price.allowanceCharge.baseAmount.value >= 0);\n return passed;\n}\n\nexport const validateCenEn16931Br28 = schematronRule(rule, evaluateCenEn16931Br28);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodEndAfterStart, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-29',\n level: 'fatal',\n message:\n 'If both Invoicing period start date (BT-73) and Invoicing period end date (BT-74) are given then the Invoicing period end date (BT-74) shall be later or equal to the Invoicing period start date (BT-73).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br29(document: PeppolDocument): boolean {\n const passed = everyPeriodEndAfterStart(document);\n return passed;\n}\n\nexport const validateCenEn16931Br29 = schematronRule(rule, evaluateCenEn16931Br29);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodEndAfterStart, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-30',\n level: 'fatal',\n message:\n 'If both Invoice line period start date (BT-134) and Invoice line period end date (BT-135) are given then the Invoice line period end date (BT-135) shall be later or equal to the Invoice line period start date (BT-134).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br30(document: PeppolDocument): boolean {\n const passed = everyPeriodEndAfterStart(document);\n return passed;\n}\n\nexport const validateCenEn16931Br30 = schematronRule(rule, evaluateCenEn16931Br30);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-31',\n level: 'fatal',\n message: 'Each Document level allowance (BG-20) shall have a Document level allowance amount (BT-92).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br31(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br31 = schematronRule(rule, evaluateCenEn16931Br31);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-32',\n level: 'fatal',\n message: 'Each Document level allowance (BG-20) shall have a Document level allowance VAT category code (BT-95).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br32(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.taxCategory?.id === 'string' && ac.taxCategory.taxSchemeId.id.toUpperCase() === 'VAT');\n return passed;\n}\n\nexport const validateCenEn16931Br32 = schematronRule(rule, evaluateCenEn16931Br32);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-33',\n level: 'fatal',\n message:\n 'Each Document level allowance (BG-20) shall have a Document level allowance reason (BT-97) or a Document level allowance reason code (BT-98).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br33(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931Br33 = schematronRule(rule, evaluateCenEn16931Br33);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-36',\n level: 'fatal',\n message: 'Each Document level charge (BG-21) shall have a Document level charge amount (BT-99).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br36(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null);\n return passed;\n}\n\nexport const validateCenEn16931Br36 = schematronRule(rule, evaluateCenEn16931Br36);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-37',\n level: 'fatal',\n message: 'Each Document level charge (BG-21) shall have a Document level charge VAT category code (BT-102).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br37(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.taxCategory?.id === 'string' && ac.taxCategory.taxSchemeId.id.toUpperCase() === 'VAT');\n return passed;\n}\n\nexport const validateCenEn16931Br37 = schematronRule(rule, evaluateCenEn16931Br37);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-38',\n level: 'fatal',\n message: 'Each Document level charge (BG-21) shall have a Document level charge reason (BT-104) or a Document level charge reason code (BT-105).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br38(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931Br38 = schematronRule(rule, evaluateCenEn16931Br38);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-41',\n level: 'fatal',\n message: 'Each Invoice line allowance (BG-27) shall have an Invoice line allowance amount (BT-136).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br41(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null)\n );\n return passed;\n}\n\nexport const validateCenEn16931Br41 = schematronRule(rule, evaluateCenEn16931Br41);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-42',\n level: 'fatal',\n message:\n 'Each Invoice line allowance (BG-27) shall have an Invoice line allowance reason (BT-139) or an Invoice line allowance reason code (BT-140).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br42(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br42 = schematronRule(rule, evaluateCenEn16931Br42);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-43',\n level: 'fatal',\n message: 'Each Invoice line charge (BG-28) shall have an Invoice line charge amount (BT-141).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br43(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => typeof ac.amount === 'object' && ac.amount !== null)\n );\n return passed;\n}\n\nexport const validateCenEn16931Br43 = schematronRule(rule, evaluateCenEn16931Br43);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-44',\n level: 'fatal',\n message: 'Each Invoice line charge shall have an Invoice line charge reason or an invoice line allowance reason code.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br44(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br44 = schematronRule(rule, evaluateCenEn16931Br44);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-45',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall have a VAT category taxable amount (BT-116).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br45(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(st => typeof st.taxableAmount === 'object' && st.taxableAmount !== null)\n );\n return passed;\n}\n\nexport const validateCenEn16931Br45 = schematronRule(rule, evaluateCenEn16931Br45);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-46',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall have a VAT category tax amount (BT-117).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br46(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => typeof st.taxAmount === 'object' && st.taxAmount !== null));\n return passed;\n}\n\nexport const validateCenEn16931Br46 = schematronRule(rule, evaluateCenEn16931Br46);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-47',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall be defined through a VAT category code (BT-118).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br47(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(st => typeof st.taxCategory?.id === 'string' && st.taxCategory.taxSchemeId.id.toUpperCase() === 'VAT')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br47 = schematronRule(rule, evaluateCenEn16931Br47);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-48',\n level: 'fatal',\n message: 'Each VAT breakdown (BG-23) shall have a VAT category rate (BT-119), except if the Invoice is not subject to VAT.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br48(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(st => typeof st.taxCategory.percent === 'number' || st.taxCategory.id === 'O')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br48 = schematronRule(rule, evaluateCenEn16931Br48);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-49',\n level: 'fatal',\n message: 'A Payment instruction (BG-16) shall specify the Payment means type code (BT-81).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br49(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(pm => typeof pm.paymentMeansCode?.code === 'string' && pm.paymentMeansCode.code.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br49 = schematronRule(rule, evaluateCenEn16931Br49);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-50',\n level: 'fatal',\n message: 'A Payment account identifier (BT-84) shall be present if Credit transfer (BG-17) information is provided in the Invoice.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br50(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(\n pm =>\n (pm.paymentMeansCode?.code !== '30' && pm.paymentMeansCode?.code !== '58') ||\n (typeof pm.payeeFinancialAccount?.id === 'string' && pm.payeeFinancialAccount.id.trim() !== '')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br50 = schematronRule(rule, evaluateCenEn16931Br50);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-51',\n level: 'warning',\n message:\n 'In accordance with card payments security standards an invoice should never include a full card primary account number (BT-87). At the moment PCI Security Standards Council has defined that the first 6 digits and last 4 digits are the maximum number of digits to be shown.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br51(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(pm => !pm.cardAccount || pm.cardAccount.primaryAccountNumberId.trim().length <= 10);\n return passed;\n}\n\nexport const validateCenEn16931Br51 = schematronRule(rule, evaluateCenEn16931Br51);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-52',\n level: 'fatal',\n message: 'Each Additional supporting document (BG-24) shall contain a Supporting document reference (BT-122).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br52(document: PeppolDocument): boolean {\n const passed = (document.additionalDocumentReferences ?? []).every(ref => typeof ref.id?.id === 'string' && ref.id.id.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931Br52 = schematronRule(rule, evaluateCenEn16931Br52);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-53',\n level: 'fatal',\n message:\n 'If the VAT accounting currency code (BT-6) is present, then the Invoice total VAT amount in accounting currency (BT-111) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br53(document: PeppolDocument): boolean {\n const passed = !document.taxCurrencyCode || document.taxTotals.some(total => total.taxAmount.currencyId === document.taxCurrencyCode);\n return passed;\n}\n\nexport const validateCenEn16931Br53 = schematronRule(rule, evaluateCenEn16931Br53);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-54',\n level: 'fatal',\n message: 'Each Item attribute (BG-32) shall contain an Item attribute name (BT-160) and an Item attribute value (BT-161).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br54(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.item.additionalItemProperties ?? []).every(\n prop => typeof prop.name === 'string' && prop.name.trim() !== '' && typeof prop.value === 'string' && prop.value.trim() !== ''\n )\n );\n return passed;\n}\n\nexport const validateCenEn16931Br54 = schematronRule(rule, evaluateCenEn16931Br54);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-55',\n level: 'fatal',\n message: 'Each Preceding Invoice reference (BG-3) shall contain a Preceding Invoice reference (BT-25).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br55(document: PeppolDocument): boolean {\n const passed = (document.billingReferences ?? []).every(\n ref => typeof ref.invoiceDocumentReference.id === 'string' && ref.invoiceDocumentReference.id.trim() !== ''\n );\n return passed;\n}\n\nexport const validateCenEn16931Br55 = schematronRule(rule, evaluateCenEn16931Br55);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-56',\n level: 'fatal',\n message: 'Each Seller tax representative party (BG-11) shall have a Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br56(document: PeppolDocument): boolean {\n const passed = !document.taxRepresentativeParty || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931Br56 = schematronRule(rule, evaluateCenEn16931Br56);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-57',\n level: 'fatal',\n message: 'Each Deliver to address (BG-15) shall contain a Deliver to country code (BT-80).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br57(document: PeppolDocument): boolean {\n const passed =\n typeof document.delivery?.deliveryLocation?.address?.countryCode.identificationCode === 'string' &&\n document.delivery.deliveryLocation.address.countryCode.identificationCode.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br57 = schematronRule(rule, evaluateCenEn16931Br57);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-61',\n level: 'fatal',\n message:\n 'If the Payment means type code (BT-81) means SEPA credit transfer, Local credit transfer or Non-SEPA international credit transfer, the Payment account identifier (BT-84) shall be present.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br61(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(\n pm =>\n (pm.paymentMeansCode?.code !== '30' && pm.paymentMeansCode?.code !== '58') ||\n (typeof pm.payeeFinancialAccount?.id === 'string' && pm.payeeFinancialAccount.id.trim() !== '')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br61 = schematronRule(rule, evaluateCenEn16931Br61);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-62',\n level: 'fatal',\n message: 'The Seller electronic address (BT-34) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br62(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingSupplierParty.endpointId?.schemeId === 'string' && document.accountingSupplierParty.endpointId.schemeId.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br62 = schematronRule(rule, evaluateCenEn16931Br62);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-63',\n level: 'fatal',\n message: 'The Buyer electronic address (BT-49) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br63(document: PeppolDocument): boolean {\n const passed =\n typeof document.accountingCustomerParty.endpointId?.schemeId === 'string' && document.accountingCustomerParty.endpointId.schemeId.trim() !== '';\n return passed;\n}\n\nexport const validateCenEn16931Br63 = schematronRule(rule, evaluateCenEn16931Br63);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-64',\n level: 'fatal',\n message: 'The Item standard identifier (BT-157) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br64(document: PeppolDocument): boolean {\n const passed = getLines(document).every(\n line => !line.item.standardItemIdentification || typeof line.item.standardItemIdentification.id.schemeId === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931Br64 = schematronRule(rule, evaluateCenEn16931Br64);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-65',\n level: 'fatal',\n message: 'The Item classification identifier (BT-158) shall have a Scheme identifier.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931Br65(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.item.commodityClassifications ?? []).every(cc => typeof cc.itemClassification.listId === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931Br65 = schematronRule(rule, evaluateCenEn16931Br65);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { noteSubjectCodeIsUncl4451, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CL-08',\n level: 'fatal',\n message: 'Invoiced note subject code shall be coded using UNCL4451',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCl08(document: PeppolDocument): boolean {\n const passed = noteSubjectCodeIsUncl4451(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCl08 = schematronRule(rule, evaluateCenEn16931BrCl08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-03',\n level: 'fatal',\n message: 'Value added tax point date (BT-7) and Value added tax point date code (BT-8) are mutually exclusive.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo03(document: PeppolDocument): boolean {\n const passed = !document.taxPointDate || !document.invoicePeriod?.descriptionCode;\n return passed;\n}\n\nexport const validateCenEn16931BrCo03 = schematronRule(rule, evaluateCenEn16931BrCo03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-04',\n level: 'fatal',\n message: 'Each Invoice line (BG-25) shall be categorized with an Invoiced item VAT category code (BT-151).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo04(document: PeppolDocument): boolean {\n const passed = getLines(document).every(\n line => typeof line.item.classifiedTaxCategory?.id === 'string' && line.item.classifiedTaxCategory.taxSchemeId.id.toUpperCase() === 'VAT'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo04 = schematronRule(rule, evaluateCenEn16931BrCo04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-05',\n level: 'fatal',\n message: 'Document level allowance reason code (BT-98) and Document level allowance reason (BT-97) shall indicate the same type of allowance.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo05(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo05 = schematronRule(rule, evaluateCenEn16931BrCo05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-06',\n level: 'fatal',\n message: 'Document level charge reason code (BT-105) and Document level charge reason (BT-104) shall indicate the same type of charge.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo06(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo06 = schematronRule(rule, evaluateCenEn16931BrCo06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-07',\n level: 'fatal',\n message: 'Invoice line allowance reason code (BT-140) and Invoice line allowance reason (BT-139) shall indicate the same type of allowance reason.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo07(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo07 = schematronRule(rule, evaluateCenEn16931BrCo07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-08',\n level: 'fatal',\n message: 'Invoice line charge reason code (BT-145) and Invoice line charge reason (BT-144) shall indicate the same type of charge reason.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo08(document: PeppolDocument): boolean {\n void document;\n return true;\n}\n\nexport const validateCenEn16931BrCo08 = schematronRule(rule, evaluateCenEn16931BrCo08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { allVatCompanyIdsHaveValidPrefix, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-09',\n level: 'fatal',\n message:\n 'The Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48) shall have a prefix in accordance with ISO code ISO 3166-1 alpha-2 by which the country of issue may be identified. Nevertheless, Greece may use the prefix ‘EL’.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo09(document: PeppolDocument): boolean {\n const passed = allVatCompanyIdsHaveValidPrefix(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo09 = schematronRule(rule, evaluateCenEn16931BrCo09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, getLines, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-10',\n level: 'fatal',\n message: 'Sum of Invoice line net amount (BT-106) = Σ Invoice line net amount (BT-131).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo10(document: PeppolDocument): boolean {\n const passed = amountsEqual(\n round2(document.legalMonetaryTotal.lineExtensionAmount.value),\n round2(getLines(document).reduce((sum, line) => sum + line.lineExtensionAmount.value, 0))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo10 = schematronRule(rule, evaluateCenEn16931BrCo10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-11',\n level: 'fatal',\n message: 'Sum of allowances on document level (BT-107) = Σ Document level allowance amount (BT-92).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo11(document: PeppolDocument): boolean {\n const passed = (() => {\n const allowances = (document.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator);\n if (!document.legalMonetaryTotal.allowanceTotalAmount) {\n return allowances.length === 0;\n }\n return amountsEqual(\n round2(document.legalMonetaryTotal.allowanceTotalAmount.value),\n round2(allowances.reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0))\n );\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo11 = schematronRule(rule, evaluateCenEn16931BrCo11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-12',\n level: 'fatal',\n message: 'Sum of charges on document level (BT-108) = Σ Document level charge amount (BT-99).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo12(document: PeppolDocument): boolean {\n const passed = (() => {\n const charges = (document.allowanceCharges ?? []).filter(ac => ac.chargeIndicator);\n if (!document.legalMonetaryTotal.chargeTotalAmount) {\n return charges.length === 0;\n }\n return amountsEqual(\n round2(document.legalMonetaryTotal.chargeTotalAmount.value),\n round2(charges.reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0))\n );\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo12 = schematronRule(rule, evaluateCenEn16931BrCo12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-13',\n level: 'fatal',\n message:\n 'Invoice total amount without VAT (BT-109) = Σ Invoice line net amount (BT-131) - Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo13(document: PeppolDocument): boolean {\n const passed = (() => {\n const total = document.legalMonetaryTotal;\n const allowance = total.allowanceTotalAmount?.value ?? 0;\n const charge = total.chargeTotalAmount?.value ?? 0;\n return amountsEqual(round2(total.taxExclusiveAmount.value), round2(total.lineExtensionAmount.value + charge - allowance));\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo13 = schematronRule(rule, evaluateCenEn16931BrCo13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-14',\n level: 'fatal',\n message: 'Invoice total VAT amount (BT-110) = Σ VAT category tax amount (BT-117).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo14(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(\n total =>\n (total.taxSubtotals?.length ?? 0) === 0 ||\n amountsEqual(round2(total.taxAmount.value), round2((total.taxSubtotals ?? []).reduce((sum, st) => sum + st.taxAmount.value, 0)))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo14 = schematronRule(rule, evaluateCenEn16931BrCo14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-15',\n level: 'fatal',\n message: 'Invoice total amount with VAT (BT-112) = Invoice total amount without VAT (BT-109) + Invoice total VAT amount (BT-110).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo15(document: PeppolDocument): boolean {\n const passed = (() => {\n const taxTotal = document.taxTotals.find(total => total.taxAmount.currencyId === document.documentCurrencyCode);\n if (!taxTotal) {\n return false;\n }\n if (document.taxTotals.filter(total => total.taxAmount.currencyId === document.documentCurrencyCode).length !== 1) {\n return false;\n }\n return amountsEqual(\n round2(document.legalMonetaryTotal.taxInclusiveAmount.value),\n round2(document.legalMonetaryTotal.taxExclusiveAmount.value + taxTotal.taxAmount.value)\n );\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo15 = schematronRule(rule, evaluateCenEn16931BrCo15);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, round2, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-16',\n level: 'fatal',\n message: 'Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Paid amount (BT-113) +Rounding amount (BT-114).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo16(document: PeppolDocument): boolean {\n const passed = (() => {\n const total = document.legalMonetaryTotal;\n const prepaid = total.prepaidAmount?.value ?? 0;\n const rounding = total.payableRoundingAmount?.value ?? 0;\n return amountsEqual(round2(total.payableAmount.value - rounding), round2(total.taxInclusiveAmount.value - prepaid));\n })();\n return passed;\n}\n\nexport const validateCenEn16931BrCo16 = schematronRule(rule, evaluateCenEn16931BrCo16);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule, vatCategoryTaxAmountMatchesRate } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-17',\n level: 'fatal',\n message: 'VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo17(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => vatCategoryTaxAmountMatchesRate(st)));\n return passed;\n}\n\nexport const validateCenEn16931BrCo17 = schematronRule(rule, evaluateCenEn16931BrCo17);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-18',\n level: 'fatal',\n message: 'An Invoice shall at least have one VAT breakdown group (BG-23).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo18(document: PeppolDocument): boolean {\n const passed = document.taxTotals.some(total => (total.taxSubtotals?.length ?? 0) > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrCo18 = schematronRule(rule, evaluateCenEn16931BrCo18);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodHasDateOrDescriptionCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-19',\n level: 'fatal',\n message:\n 'If Invoicing period (BG-14) is used, the Invoicing period start date (BT-73) or the Invoicing period end date (BT-74) shall be filled, or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo19(document: PeppolDocument): boolean {\n const passed = everyPeriodHasDateOrDescriptionCode(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo19 = schematronRule(rule, evaluateCenEn16931BrCo19);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyPeriodHasDateOrDescriptionCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-20',\n level: 'fatal',\n message:\n 'If Invoice line period (BG-26) is used, the Invoice line period start date (BT-134) or the Invoice line period end date (BT-135) shall be filled, or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo20(document: PeppolDocument): boolean {\n const passed = everyPeriodHasDateOrDescriptionCode(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo20 = schematronRule(rule, evaluateCenEn16931BrCo20);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-21',\n level: 'fatal',\n message:\n 'Each Document level allowance (BG-20) shall contain a Document level allowance reason (BT-97) or a Document level allowance reason code (BT-98), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo21(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931BrCo21 = schematronRule(rule, evaluateCenEn16931BrCo21);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-22',\n level: 'fatal',\n message:\n 'Each Document level charge (BG-21) shall contain a Document level charge reason (BT-104) or a Document level charge reason code (BT-105), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo22(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string');\n return passed;\n}\n\nexport const validateCenEn16931BrCo22 = schematronRule(rule, evaluateCenEn16931BrCo22);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-23',\n level: 'fatal',\n message:\n 'Each Invoice line allowance (BG-27) shall contain an Invoice line allowance reason (BT-139) or an Invoice line allowance reason code (BT-140), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo23(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo23 = schematronRule(rule, evaluateCenEn16931BrCo23);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-24',\n level: 'fatal',\n message:\n 'Each Invoice line charge (BG-28) shall contain an Invoice line charge reason (BT-144) or an Invoice line charge reason code (BT-145), or both.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo24(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => typeof ac.allowanceChargeReason === 'string' || typeof ac.allowanceChargeReasonCode === 'string')\n );\n return passed;\n}\n\nexport const validateCenEn16931BrCo24 = schematronRule(rule, evaluateCenEn16931BrCo24);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-25',\n level: 'fatal',\n message:\n 'In case the Amount due for payment (BT-115) is positive, either the Payment due date (BT-9) or the Payment terms (BT-20) shall be present.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo25(document: PeppolDocument): boolean {\n const passed =\n document.legalMonetaryTotal.payableAmount.value <= 0 || typeof document.dueDate === 'string' || typeof document.paymentTerms?.note === 'string';\n return passed;\n}\n\nexport const validateCenEn16931BrCo25 = schematronRule(rule, evaluateCenEn16931BrCo25);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasSellerLegalCompanyId, hasSellerTaxIdentifier, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-CO-26',\n level: 'fatal',\n message:\n 'In order for the buyer to automatically identify a supplier, the Seller identifier (BT-29), the Seller legal registration identifier (BT-30) and/or the Seller VAT identifier (BT-31) shall be present.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrCo26(document: PeppolDocument): boolean {\n const passed =\n hasSellerTaxIdentifier(document) ||\n typeof document.accountingSupplierParty.partyIdentification?.id.id === 'string' ||\n hasSellerLegalCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrCo26 = schematronRule(rule, evaluateCenEn16931BrCo26);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-01',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level allowance amount (BT-92) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec01(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec01 = schematronRule(rule, evaluateCenEn16931BrDec01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-02',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level allowance base amount (BT-93) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec02(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => !ac.chargeIndicator)\n .every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec02 = schematronRule(rule, evaluateCenEn16931BrDec02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-05',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level charge amount (BT-99) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec05(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec05 = schematronRule(rule, evaluateCenEn16931BrDec05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-06',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Document level charge base amount (BT-100) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec06(document: PeppolDocument): boolean {\n const passed = (document.allowanceCharges ?? [])\n .filter(ac => ac.chargeIndicator)\n .every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec06 = schematronRule(rule, evaluateCenEn16931BrDec06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-09',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Sum of Invoice line net amount (BT-106) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec09(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.lineExtensionAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.lineExtensionAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec09 = schematronRule(rule, evaluateCenEn16931BrDec09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-10',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Sum of allowanced on document level (BT-107) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec10(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.allowanceTotalAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.allowanceTotalAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec10 = schematronRule(rule, evaluateCenEn16931BrDec10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-11',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Sum of charges on document level (BT-108) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec11(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.chargeTotalAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.chargeTotalAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec11 = schematronRule(rule, evaluateCenEn16931BrDec11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-12',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total amount without VAT (BT-109) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec12(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.taxExclusiveAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.taxExclusiveAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec12 = schematronRule(rule, evaluateCenEn16931BrDec12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-13',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total VAT amount (BT-110) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec13(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(\n total => total.taxAmount.currencyId !== document.documentCurrencyCode || hasMaxTwoDecimals(total.taxAmount.value)\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec13 = schematronRule(rule, evaluateCenEn16931BrDec13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-14',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total amount with VAT (BT-112) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec14(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.taxInclusiveAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.taxInclusiveAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec14 = schematronRule(rule, evaluateCenEn16931BrDec14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-15',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice total VAT amount in accounting currency (BT-111) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec15(document: PeppolDocument): boolean {\n const passed =\n !document.taxCurrencyCode ||\n document.taxTotals.every(total => total.taxAmount.currencyId !== document.taxCurrencyCode || hasMaxTwoDecimals(total.taxAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec15 = schematronRule(rule, evaluateCenEn16931BrDec15);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-16',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Paid amount (BT-113) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec16(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.prepaidAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.prepaidAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec16 = schematronRule(rule, evaluateCenEn16931BrDec16);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-17',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Rounding amount (BT-114) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec17(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.payableRoundingAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.payableRoundingAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec17 = schematronRule(rule, evaluateCenEn16931BrDec17);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-18',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Amount due for payment (BT-115) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec18(document: PeppolDocument): boolean {\n const passed = !document.legalMonetaryTotal.payableAmount || hasMaxTwoDecimals(document.legalMonetaryTotal.payableAmount.value);\n return passed;\n}\n\nexport const validateCenEn16931BrDec18 = schematronRule(rule, evaluateCenEn16931BrDec18);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-19',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the VAT category taxable amount (BT-116) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec19(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => hasMaxTwoDecimals(st.taxableAmount.value)));\n return passed;\n}\n\nexport const validateCenEn16931BrDec19 = schematronRule(rule, evaluateCenEn16931BrDec19);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-20',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the VAT category tax amount (BT-117) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec20(document: PeppolDocument): boolean {\n const passed = document.taxTotals.every(total => (total.taxSubtotals ?? []).every(st => hasMaxTwoDecimals(st.taxAmount.value)));\n return passed;\n}\n\nexport const validateCenEn16931BrDec20 = schematronRule(rule, evaluateCenEn16931BrDec20);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-23',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line net amount (BT-131) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec23(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => hasMaxTwoDecimals(line.lineExtensionAmount.value));\n return passed;\n}\n\nexport const validateCenEn16931BrDec23 = schematronRule(rule, evaluateCenEn16931BrDec23);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-24',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line allowance amount (BT-136) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec24(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec24 = schematronRule(rule, evaluateCenEn16931BrDec24);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-25',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line allowance base amount (BT-137) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec25(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec25 = schematronRule(rule, evaluateCenEn16931BrDec25);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-27',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line charge amount (BT-141) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec27(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => !ac.amount || hasMaxTwoDecimals(ac.amount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec27 = schematronRule(rule, evaluateCenEn16931BrDec27);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasMaxTwoDecimals, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-DEC-28',\n level: 'fatal',\n message: 'The allowed maximum number of decimals for the Invoice line charge base amount (BT-142) is 2.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrDec28(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line =>\n (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).every(ac => !ac.baseAmount || hasMaxTwoDecimals(ac.baseAmount.value))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrDec28 = schematronRule(rule, evaluateCenEn16931BrDec28);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Exempt from VAT\" shall contain exactly one VAT breakdown (BG-23) with the VAT category code (BT-118) equal to \"Exempt from VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'E') || countVatBreakdownCode(document, 'E') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrE01 = schematronRule(rule, evaluateCenEn16931BrE01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Exempt from VAT\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'E') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrE02 = schematronRule(rule, evaluateCenEn16931BrE02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Exempt from VAT\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'E') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrE03 = schematronRule(rule, evaluateCenEn16931BrE03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Exempt from VAT\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'E') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrE04 = schematronRule(rule, evaluateCenEn16931BrE04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Exempt from VAT\", the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'E', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE05 = schematronRule(rule, evaluateCenEn16931BrE05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Exempt from VAT\", the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'E', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE06 = schematronRule(rule, evaluateCenEn16931BrE06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Exempt from VAT\", the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'E', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE07 = schematronRule(rule, evaluateCenEn16931BrE07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Exempt from VAT\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Exempt from VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'E').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'E')));\n return passed;\n}\n\nexport const validateCenEn16931BrE08 = schematronRule(rule, evaluateCenEn16931BrE08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) In a VAT breakdown (BG-23) where the VAT category code (BT-118) equals \"Exempt from VAT\" shall equal 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'E').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrE09 = schematronRule(rule, evaluateCenEn16931BrE09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-E-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Exempt from VAT\" shall have a VAT exemption reason code (BT-121) or a VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrE10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'E').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrE10 = schematronRule(rule, evaluateCenEn16931BrE10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Export outside the EU\" shall contain in the VAT breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"Export outside the EU\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'G') || countVatBreakdownCode(document, 'G') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrG01 = schematronRule(rule, evaluateCenEn16931BrG01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerVatCompanyId, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Export outside the EU\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'G') || hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrG02 = schematronRule(rule, evaluateCenEn16931BrG02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Export outside the EU\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG03(document: PeppolDocument): boolean {\n const passed = !hasDocumentAllowanceVatCategoryCode(document, 'G') || hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrG03 = schematronRule(rule, evaluateCenEn16931BrG03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerVatCompanyId, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Export outside the EU\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'G') || hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrG04 = schematronRule(rule, evaluateCenEn16931BrG04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Export outside the EU\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'G', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG05 = schematronRule(rule, evaluateCenEn16931BrG05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Export outside the EU\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'G', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG06 = schematronRule(rule, evaluateCenEn16931BrG06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Export outside the EU\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'G', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG07 = schematronRule(rule, evaluateCenEn16931BrG07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Export outside the EU\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Export outside the EU\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'G').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'G')));\n return passed;\n}\n\nexport const validateCenEn16931BrG08 = schematronRule(rule, evaluateCenEn16931BrG08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Export outside the EU\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'G').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrG09 = schematronRule(rule, evaluateCenEn16931BrG09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-G-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with the VAT Category code (BT-118) \"Export outside the EU\" shall have a VAT exemption reason code (BT-121), meaning \"Export outside the EU\" or the VAT exemption reason text (BT-120) \"Export outside the EU\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrG10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'G').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrG10 = schematronRule(rule, evaluateCenEn16931BrG10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Intra-community supply\" shall contain in the VAT breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"Intra-community supply\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'K') || countVatBreakdownCode(document, 'K') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrIc01 = schematronRule(rule, evaluateCenEn16931BrIc01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasLineVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Intra-community supply\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc02(document: PeppolDocument): boolean {\n const passed =\n !hasLineVatCategoryCode(document, 'K') ||\n ((hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document)) && hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrIc02 = schematronRule(rule, evaluateCenEn16931BrIc02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentAllowanceVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Intra-community supply\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'K') ||\n ((hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document)) && hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrIc03 = schematronRule(rule, evaluateCenEn16931BrIc03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentChargeVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Intra-community supply\" shall contain the Seller VAT Identifier (BT-31) or the Seller tax representative VAT identifier (BT-63) and the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc04(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentChargeVatCategoryCode(document, 'K') ||\n ((hasSellerVatCompanyId(document) || hasTaxRepresentativeVatCompanyId(document)) && hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrIc04 = schematronRule(rule, evaluateCenEn16931BrIc04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Intracommunity supply\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'K', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc05 = schematronRule(rule, evaluateCenEn16931BrIc05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Intra-community supply\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'K', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc06 = schematronRule(rule, evaluateCenEn16931BrIc06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Intra-community supply\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'K', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc07 = schematronRule(rule, evaluateCenEn16931BrIc07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Intra-community supply\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'K').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'K')));\n return passed;\n}\n\nexport const validateCenEn16931BrIc08 = schematronRule(rule, evaluateCenEn16931BrIc08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'K').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrIc09 = schematronRule(rule, evaluateCenEn16931BrIc09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with the VAT Category code (BT-118) \"Intra-community supply\" shall have a VAT exemption reason code (BT-121), meaning \"Intra-community supply\" or the VAT exemption reason text (BT-120) \"Intra-community supply\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'K').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrIc10 = schematronRule(rule, evaluateCenEn16931BrIc10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-11',\n level: 'fatal',\n message:\n 'In an Invoice with a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" the Actual delivery date (BT-72) or the Invoicing period (BG-14) shall not be blank.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc11(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'K') ||\n (typeof document.delivery?.actualDeliveryDate === 'string' && document.delivery.actualDeliveryDate.trim() !== '') ||\n typeof document.invoicePeriod === 'object';\n return passed;\n}\n\nexport const validateCenEn16931BrIc11 = schematronRule(rule, evaluateCenEn16931BrIc11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-IC-12',\n level: 'fatal',\n message:\n 'In an Invoice with a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Intra-community supply\" the Deliver to country code (BT-80) shall not be blank.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrIc12(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'K') ||\n (typeof document.delivery?.deliveryLocation?.address?.countryCode.identificationCode === 'string' &&\n document.delivery.deliveryLocation.address.countryCode.identificationCode.trim() !== '');\n return passed;\n}\n\nexport const validateCenEn16931BrIc12 = schematronRule(rule, evaluateCenEn16931BrIc12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Not subject to VAT\" shall contain exactly one VAT breakdown group (BG-23) with the VAT category code (BT-118) equal to \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'O') || countVatBreakdownCode(document, 'O') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrO01 = schematronRule(rule, evaluateCenEn16931BrO01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasLineVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Not subject to VAT\" shall not contain the Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) or the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO02(document: PeppolDocument): boolean {\n const passed =\n !hasLineVatCategoryCode(document, 'O') ||\n (!hasSellerVatCompanyId(document) && !hasTaxRepresentativeVatCompanyId(document) && !hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrO02 = schematronRule(rule, evaluateCenEn16931BrO02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentAllowanceVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Not subject to VAT\" shall not contain the Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) or the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'O') ||\n (!hasSellerVatCompanyId(document) && !hasTaxRepresentativeVatCompanyId(document) && !hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrO03 = schematronRule(rule, evaluateCenEn16931BrO03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasBuyerVatCompanyId,\n hasDocumentChargeVatCategoryCode,\n hasSellerVatCompanyId,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Not subject to VAT\" shall not contain the Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) or the Buyer VAT identifier (BT-48).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO04(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentChargeVatCategoryCode(document, 'O') ||\n (!hasSellerVatCompanyId(document) && !hasTaxRepresentativeVatCompanyId(document) && !hasBuyerVatCompanyId(document));\n return passed;\n}\n\nexport const validateCenEn16931BrO04 = schematronRule(rule, evaluateCenEn16931BrO04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-05',\n level: 'fatal',\n message:\n 'An Invoice line (BG-25) where the VAT category code (BT-151) is \"Not subject to VAT\" shall not contain an Invoiced item VAT rate (BT-152).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'O', percent => percent === undefined);\n return passed;\n}\n\nexport const validateCenEn16931BrO05 = schematronRule(rule, evaluateCenEn16931BrO05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-06',\n level: 'fatal',\n message:\n 'A Document level allowance (BG-20) where VAT category code (BT-95) is \"Not subject to VAT\" shall not contain a Document level allowance VAT rate (BT-96).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'O', percent => percent === undefined);\n return passed;\n}\n\nexport const validateCenEn16931BrO06 = schematronRule(rule, evaluateCenEn16931BrO06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-07',\n level: 'fatal',\n message:\n 'A Document level charge (BG-21) where the VAT category code (BT-102) is \"Not subject to VAT\" shall not contain a Document level charge VAT rate (BT-103).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'O', percent => percent === undefined);\n return passed;\n}\n\nexport const validateCenEn16931BrO07 = schematronRule(rule, evaluateCenEn16931BrO07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where the VAT category code (BT-118) is \" Not subject to VAT\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'O').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'O')));\n return passed;\n}\n\nexport const validateCenEn16931BrO08 = schematronRule(rule, evaluateCenEn16931BrO08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where the VAT category code (BT-118) is \"Not subject to VAT\" shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'O').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrO09 = schematronRule(rule, evaluateCenEn16931BrO09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \" Not subject to VAT\" shall have a VAT exemption reason code (BT-121), meaning \" Not subject to VAT\" or a VAT exemption reason text (BT-120) \" Not subject to VAT\" (or the equivalent standard text in another language).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'O').every(\n st => typeof st.taxCategory.taxExemptionReason === 'string' || typeof st.taxCategory.taxExemptionReasonCode === 'string'\n );\n return passed;\n}\n\nexport const validateCenEn16931BrO10 = schematronRule(rule, evaluateCenEn16931BrO10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countAllVatBreakdowns, countVatBreakdownCode, hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-11',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain other VAT breakdown groups (BG-23).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO11(document: PeppolDocument): boolean {\n const passed = !hasVatBreakdownCode(document, 'O') || countVatBreakdownCode(document, 'O') === countAllVatBreakdowns(document);\n return passed;\n}\n\nexport const validateCenEn16931BrO11 = schematronRule(rule, evaluateCenEn16931BrO11);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-12',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is not \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO12(document: PeppolDocument): boolean {\n const passed = !hasVatBreakdownCode(document, 'O') || getLines(document).every(line => line.item.classifiedTaxCategory.id === 'O');\n return passed;\n}\n\nexport const validateCenEn16931BrO12 = schematronRule(rule, evaluateCenEn16931BrO12);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-13',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain Document level allowances (BG-20) where Document level allowance VAT category code (BT-95) is not \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO13(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'O') ||\n (document.allowanceCharges ?? []).every(ac => ac.chargeIndicator || ac.taxCategory?.id === undefined || ac.taxCategory.id === 'O');\n return passed;\n}\n\nexport const validateCenEn16931BrO13 = schematronRule(rule, evaluateCenEn16931BrO13);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasVatBreakdownCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-O-14',\n level: 'fatal',\n message:\n 'An Invoice that contains a VAT breakdown group (BG-23) with a VAT category code (BT-118) \"Not subject to VAT\" shall not contain Document level charges (BG-21) where Document level charge VAT category code (BT-102) is not \"Not subject to VAT\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrO14(document: PeppolDocument): boolean {\n const passed =\n !hasVatBreakdownCode(document, 'O') ||\n (document.allowanceCharges ?? []).every(ac => !ac.chargeIndicator || ac.taxCategory?.id === undefined || ac.taxCategory.id === 'O');\n return passed;\n}\n\nexport const validateCenEn16931BrO14 = schematronRule(rule, evaluateCenEn16931BrO14);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Standard rated\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"Standard rated\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'S') || countVatBreakdownCode(document, 'S') > 0;\n return passed;\n}\n\nexport const validateCenEn16931BrS01 = schematronRule(rule, evaluateCenEn16931BrS01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Standard rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'S') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS02 = schematronRule(rule, evaluateCenEn16931BrS02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Standard rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'S') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS03 = schematronRule(rule, evaluateCenEn16931BrS03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Standard rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'S') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS04 = schematronRule(rule, evaluateCenEn16931BrS04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Standard rated\" the Invoiced item VAT rate (BT-152) shall be greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'S', percent => percent !== undefined && percent > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrS05 = schematronRule(rule, evaluateCenEn16931BrS05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Standard rated\" the Document level allowance VAT rate (BT-96) shall be greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'S', percent => percent !== undefined && percent > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrS06 = schematronRule(rule, evaluateCenEn16931BrS06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Standard rated\" the Document level charge VAT rate (BT-103) shall be greater than zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'S', percent => percent !== undefined && percent > 0);\n return passed;\n}\n\nexport const validateCenEn16931BrS07 = schematronRule(rule, evaluateCenEn16931BrS07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyVatBreakdownTaxableMatchesRateSum, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-08',\n level: 'fatal',\n message:\n 'For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"Standard rated\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"Standard rated\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS08(document: PeppolDocument): boolean {\n const passed = everyVatBreakdownTaxableMatchesRateSum(document);\n return passed;\n}\n\nexport const validateCenEn16931BrS08 = schematronRule(rule, evaluateCenEn16931BrS08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, round2, schematronRule, withinSlackOne } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-09',\n level: 'fatal',\n message:\n 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"Standard rated\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'S').every(st =>\n withinSlackOne(st.taxAmount, round2((st.taxableAmount * (st.taxCategory.percent ?? 0)) / 100))\n );\n return passed;\n}\n\nexport const validateCenEn16931BrS09 = schematronRule(rule, evaluateCenEn16931BrS09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-S-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Standard rate\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrS10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'S').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrS10 = schematronRule(rule, evaluateCenEn16931BrS10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { countVatBreakdownCode, hasAnyVatCategoryCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-01',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"Zero rated\" shall contain in the VAT breakdown (BG-23) exactly one VAT category code (BT-118) equal with \"Zero rated\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ01(document: PeppolDocument): boolean {\n const passed = !hasAnyVatCategoryCode(document, 'Z') || countVatBreakdownCode(document, 'Z') === 1;\n return passed;\n}\n\nexport const validateCenEn16931BrZ01 = schematronRule(rule, evaluateCenEn16931BrZ01);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasLineVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-02',\n level: 'fatal',\n message:\n 'An Invoice that contains an Invoice line where the Invoiced item VAT category code (BT-151) is \"Zero rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ02(document: PeppolDocument): boolean {\n const passed = !hasLineVatCategoryCode(document, 'Z') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrZ02 = schematronRule(rule, evaluateCenEn16931BrZ02);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport {\n hasDocumentAllowanceVatCategoryCode,\n hasSellerTaxIdentifier,\n hasTaxRepresentativeVatCompanyId,\n schematronRule,\n} from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-03',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Zero rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ03(document: PeppolDocument): boolean {\n const passed =\n !hasDocumentAllowanceVatCategoryCode(document, 'Z') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrZ03 = schematronRule(rule, evaluateCenEn16931BrZ03);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { hasDocumentChargeVatCategoryCode, hasSellerTaxIdentifier, hasTaxRepresentativeVatCompanyId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-04',\n level: 'fatal',\n message:\n 'An Invoice that contains a Document level charge where the Document level charge VAT category code (BT-102) is \"Zero rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ04(document: PeppolDocument): boolean {\n const passed = !hasDocumentChargeVatCategoryCode(document, 'Z') || hasSellerTaxIdentifier(document) || hasTaxRepresentativeVatCompanyId(document);\n return passed;\n}\n\nexport const validateCenEn16931BrZ04 = schematronRule(rule, evaluateCenEn16931BrZ04);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyLineCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-05',\n level: 'fatal',\n message:\n 'In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Zero rated\" the Invoiced item VAT rate (BT-152) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ05(document: PeppolDocument): boolean {\n const passed = everyLineCategoryPercent(document, 'Z', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ05 = schematronRule(rule, evaluateCenEn16931BrZ05);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentAllowanceCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-06',\n level: 'fatal',\n message:\n 'In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"Zero rated\" the Document level allowance VAT rate (BT-96) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ06(document: PeppolDocument): boolean {\n const passed = everyDocumentAllowanceCategoryPercent(document, 'Z', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ06 = schematronRule(rule, evaluateCenEn16931BrZ06);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { everyDocumentChargeCategoryPercent, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-07',\n level: 'fatal',\n message:\n 'In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"Zero rated\" the Document level charge VAT rate (BT-103) shall be 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ07(document: PeppolDocument): boolean {\n const passed = everyDocumentChargeCategoryPercent(document, 'Z', percent => percent === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ07 = schematronRule(rule, evaluateCenEn16931BrZ07);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { amountsEqual, categoryTaxableSum, getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-08',\n level: 'fatal',\n message:\n 'In a VAT breakdown (BG-23) where VAT category code (BT-118) is \"Zero rated\" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amount (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are \"Zero rated\".',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ08(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'Z').every(st => amountsEqual(st.taxableAmount, categoryTaxableSum(document, 'Z')));\n return passed;\n}\n\nexport const validateCenEn16931BrZ08 = schematronRule(rule, evaluateCenEn16931BrZ08);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-09',\n level: 'fatal',\n message: 'The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"Zero rated\" shall equal 0 (zero).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ09(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'Z').every(st => st.taxAmount === 0);\n return passed;\n}\n\nexport const validateCenEn16931BrZ09 = schematronRule(rule, evaluateCenEn16931BrZ09);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getTaxSubtotalsWithCode, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'CEN-EN16931-BR-Z-10',\n level: 'fatal',\n message:\n 'A VAT breakdown (BG-23) with VAT Category code (BT-118) \"Zero rated\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).',\n} as const satisfies SchematronRule;\n\nfunction evaluateCenEn16931BrZ10(document: PeppolDocument): boolean {\n const passed = getTaxSubtotalsWithCode(document, 'Z').every(\n st => st.taxCategory.taxExemptionReason === undefined && st.taxCategory.taxExemptionReasonCode === undefined\n );\n return passed;\n}\n\nexport const validateCenEn16931BrZ10 = schematronRule(rule, evaluateCenEn16931BrZ10);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-001',\n level: 'fatal',\n message: 'An invoice shall contain information on \"PAYMENT INSTRUCTIONS\" (BG-16).',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR001(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n return (document.paymentMeans?.length ?? 0) > 0;\n}\n\nexport const validateDeR001 = schematronRule(rule, evaluateDeR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DE-R-002', level: 'fatal', message: 'The group \"SELLER CONTACT\" (BG-6) shall be provided.' } as const satisfies SchematronRule;\n\nfunction evaluateDeR002(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n return Boolean(document.accountingSupplierParty.contact);\n}\n\nexport const validateDeR002 = schematronRule(rule, evaluateDeR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DE-R-003', level: 'fatal', message: 'The element \"Seller city\" (BT-37) shall be provided.' } as const satisfies SchematronRule;\n\nfunction evaluateDeR003(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const cityName = document.accountingSupplierParty.postalAddress.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateDeR003 = schematronRule(rule, evaluateDeR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-004',\n level: 'fatal',\n message: 'The element \"Seller post code\" (BT-38) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR004(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const postalZone = document.accountingSupplierParty.postalAddress.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateDeR004 = schematronRule(rule, evaluateDeR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-005',\n level: 'fatal',\n message: 'The element \"Seller contact point\" (BT-41) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR005(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const name = document.accountingSupplierParty.contact?.name;\n return typeof name === 'string' && name.trim() !== '';\n}\n\nexport const validateDeR005 = schematronRule(rule, evaluateDeR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-006',\n level: 'fatal',\n message: 'The element \"Seller contact telephone number\" (BT-42) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR006(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const telephone = document.accountingSupplierParty.contact?.telephone;\n return typeof telephone === 'string' && telephone.trim() !== '';\n}\n\nexport const validateDeR006 = schematronRule(rule, evaluateDeR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-007',\n level: 'fatal',\n message: 'The element \"Seller contact email address\" (BT-43) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR007(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const email = document.accountingSupplierParty.contact?.electronicMail;\n return typeof email === 'string' && email.trim() !== '';\n}\n\nexport const validateDeR007 = schematronRule(rule, evaluateDeR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DE-R-008', level: 'fatal', message: 'The element \"Buyer city\" (BT-52) shall be provided.' } as const satisfies SchematronRule;\n\nfunction evaluateDeR008(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const cityName = document.accountingCustomerParty.postalAddress.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateDeR008 = schematronRule(rule, evaluateDeR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-009',\n level: 'fatal',\n message: 'The element \"Buyer post code\" (BT-53) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR009(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const postalZone = document.accountingCustomerParty.postalAddress.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateDeR009 = schematronRule(rule, evaluateDeR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-010',\n level: 'fatal',\n message: 'The element \"Deliver to city\" (BT-77) shall be provided if the group \"DELIVER TO ADDRESS\" (BG-15) is delivered.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR010(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const address = document.delivery?.deliveryLocation?.address;\n if (!address) {\n return true;\n }\n const cityName = address.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateDeR010 = schematronRule(rule, evaluateDeR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-011',\n level: 'fatal',\n message: 'The element \"Deliver to post code\" (BT-78) shall be provided if the group \"DELIVER TO ADDRESS\" (BG-15) is delivered.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR011(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const address = document.delivery?.deliveryLocation?.address;\n if (!address) {\n return true;\n }\n const postalZone = address.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateDeR011 = schematronRule(rule, evaluateDeR011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-014',\n level: 'fatal',\n message: 'The element \"VAT category rate\" (BT-119) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR014(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = document.taxTotals.every(total =>\n (total.taxSubtotals ?? []).every(subtotal => typeof subtotal.taxCategory.percent === 'number' && subtotal.taxCategory.percent > 0)\n );\n return passed;\n}\n\nexport const validateDeR014 = schematronRule(rule, evaluateDeR014);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-015',\n level: 'fatal',\n message: 'The element \"Buyer reference\" (BT-10) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR015(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const buyerReference = document.buyerReference;\n return typeof buyerReference === 'string' && buyerReference.trim() !== '';\n}\n\nexport const validateDeR015 = schematronRule(rule, evaluateDeR015);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, getLines, isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-016',\n level: 'fatal',\n message:\n 'If one of the VAT codes S, Z, E, AE, K, G, L, or M is used, an invoice shall contain at least one of the following elements: \"Seller VAT identifier\" (BT-31) or \"Seller tax registration identifier\" (BT-32) or \"SELLER TAX REPRESENTATIVE PARTY\" (BG-11).',\n} as const satisfies SchematronRule;\n\nconst SUPPORTED_VAT_CODES = new Set(['S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M']);\n\nfunction evaluateDeR016(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const lineCodes = getLines(document).map(line => line.item.classifiedTaxCategory.id);\n const allowanceCodes = getAllAllowanceCharges(document)\n .map(ac => ac.taxCategoryId)\n .filter((code): code is string => code !== undefined);\n const usesSupportedCode = [...lineCodes, ...allowanceCodes].some(code => SUPPORTED_VAT_CODES.has(code));\n if (!usesSupportedCode) {\n return true;\n }\n const hasTaxRepresentative = Boolean(document.taxRepresentativeParty);\n const hasSellerTaxId = document.accountingSupplierParty.partyTaxSchemes?.some(scheme => scheme.companyId.trim() !== '') ?? false;\n return hasTaxRepresentative || hasSellerTaxId;\n}\n\nexport const validateDeR016 = schematronRule(rule, evaluateDeR016);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-017',\n level: 'warning',\n message:\n 'The element \"Invoice type code\" (BT-3) should only contain the following values from code list UNTDID 1001: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice), 381 (Credit note), 875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['326', '380', '384', '389', '381', '875', '876', '877']);\n\nfunction evaluateDeR017(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const code = 'invoiceTypeCode' in document ? document.invoiceTypeCode : 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n return code === undefined || ALLOWED_CODES.has(code);\n}\n\nexport const validateDeR017 = schematronRule(rule, evaluateDeR017);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-018',\n level: 'fatal',\n message:\n 'Information on cash discounts for prompt payment (Skonto) shall be provided within the element \"Payment terms\" BT-20 in the following way: First segment \"SKONTO\", second segment amount of days (\"TAGE=N\"), third segment percentage (\"PROZENT=N\"). Percentage must be separated by dot with two decimal places. In case the base value of the invoiced amount is not provided in BT-115 but as a partial amount, the base value shall be provided as fourth segment \"BASISBETRAG=N\" as semantic data type amount. Each entry shall start with a #, the segments must be separated by # and a row shall end with a #. A complete statement on cash discount for prompt payment shall end with a XML-conformant line break.',\n} as const satisfies SchematronRule;\n\nconst SKONTO_REGEX = /^#(SKONTO)#TAGE=([0-9]+#PROZENT=[0-9]+\\.[0-9]{2})(#BASISBETRAG=-?[0-9]+\\.[0-9]{2})?#$/;\n\nfunction evaluateDeR018(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const note = document.paymentTerms?.note;\n if (note === undefined) {\n return true;\n }\n const lines = note.split(/\\r?\\n/).filter(line => line.startsWith('#'));\n if (lines.length === 0) {\n return true;\n }\n const passed = lines.every(line => SKONTO_REGEX.test(line.trim()));\n return passed;\n}\n\nexport const validateDeR018 = schematronRule(rule, evaluateDeR018);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidIBAN } from '#/peppol-validations/is-valid-iban.ts';\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-019',\n level: 'warning',\n message:\n 'The element \"Payment account identifier\" (BT-84) should contain a valid IBAN if code 58 SEPA is provided in \"Payment means type code\" (BT-81).',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR019(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '58') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId === undefined || isValidIBAN(accountId);\n });\n return passed;\n}\n\nexport const validateDeR019 = schematronRule(rule, evaluateDeR019);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidIBAN } from '#/peppol-validations/is-valid-iban.ts';\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-020',\n level: 'warning',\n message:\n 'The element \"Debited account identifier\" (BT-91) should contain a valid IBAN if code 59 SEPA is provided in \"Payment means type code\" (BT-81). ',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR020(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '59') {\n return true;\n }\n const debitedAccountId = payment.paymentMandate?.payerFinancialAccountId?.id;\n return debitedAccountId === undefined || isValidIBAN(debitedAccountId);\n });\n return passed;\n}\n\nexport const validateDeR020 = schematronRule(rule, evaluateDeR020);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-022',\n level: 'fatal',\n message:\n 'Attached documents provided with an invoice in \"ADDITIONAL SUPPORTING DOCUMENTS\" (BG-24) shall have a unique filename (non case-sensitive) within the element \"Attached document\" (BT-125).',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR022(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const filenames = (document.additionalDocumentReferences ?? [])\n .map(ref => ref.attachment?.embeddedDocumentBinaryObject?.filename)\n .filter((filename): filename is string => filename !== undefined)\n .map(filename => filename.toLowerCase());\n return new Set(filenames).size === filenames.length;\n}\n\nexport const validateDeR022 = schematronRule(rule, evaluateDeR022);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-023-1',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for credit transfer (30, 58), \"CREDIT TRANSFER\" (BG-17) shall be provided.',\n} as const satisfies SchematronRule;\n\nconst CREDIT_TRANSFER_CODES = new Set(['30', '58']);\n\nfunction evaluateDeR023_1(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CREDIT_TRANSFER_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return Boolean(payment.payeeFinancialAccount);\n });\n return passed;\n}\n\nexport const validateDeR023_1 = schematronRule(rule, evaluateDeR023_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-023-2',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for credit transfer (30, 58), BG-18 and BG-19 shall not be provided.',\n} as const satisfies SchematronRule;\n\nconst CREDIT_TRANSFER_CODES = new Set(['30', '58']);\n\nfunction evaluateDeR023_2(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CREDIT_TRANSFER_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return !payment.cardAccount && !payment.paymentMandate;\n });\n return passed;\n}\n\nexport const validateDeR023_2 = schematronRule(rule, evaluateDeR023_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-024-1',\n level: 'fatal',\n message:\n 'If \"Payment means type code\" (BT-81) contains a code for payment card (48, 54, 55), \"PAYMENT CARD INFORMATION\" (BG-18) shall be provided.',\n} as const satisfies SchematronRule;\n\nconst CARD_CODES = new Set(['48', '54', '55']);\n\nfunction evaluateDeR024_1(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CARD_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return Boolean(payment.cardAccount);\n });\n return passed;\n}\n\nexport const validateDeR024_1 = schematronRule(rule, evaluateDeR024_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-024-2',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for payment card (48, 54, 55), BG-17 and BG-19 shall not be provided.',\n} as const satisfies SchematronRule;\n\nconst CARD_CODES = new Set(['48', '54', '55']);\n\nfunction evaluateDeR024_2(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!CARD_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n return !payment.payeeFinancialAccount && !payment.paymentMandate;\n });\n return passed;\n}\n\nexport const validateDeR024_2 = schematronRule(rule, evaluateDeR024_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-025-1',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for direct debit (59), \"DIRECT DEBIT\" (BG-19) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR025_1(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '59') {\n return true;\n }\n return Boolean(payment.paymentMandate);\n });\n return passed;\n}\n\nexport const validateDeR025_1 = schematronRule(rule, evaluateDeR025_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-025-2',\n level: 'fatal',\n message: 'If \"Payment means type code\" (BT-81) contains a code for direct debit (59), BG-17 and BG-18 shall not be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR025_2(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '59') {\n return true;\n }\n return !payment.payeeFinancialAccount && !payment.cardAccount;\n });\n return passed;\n}\n\nexport const validateDeR025_2 = schematronRule(rule, evaluateDeR025_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-026',\n level: 'warning',\n message:\n 'If \"Invoice type code\" (BT-3) contains the code 384 (Corrected invoice), \"PRECEDING INVOICE REFERENCE\" (BG-3) should be provided at least once.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR026(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const invoiceTypeCode = 'invoiceTypeCode' in document ? document.invoiceTypeCode : undefined;\n const creditNoteTypeCode = 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n if (invoiceTypeCode !== '384' && creditNoteTypeCode !== '384') {\n return true;\n }\n const hasPrecedingInvoiceReference = (document.billingReferences?.length ?? 0) > 0;\n return hasPrecedingInvoiceReference;\n}\n\nexport const validateDeR026 = schematronRule(rule, evaluateDeR026);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-027',\n level: 'warning',\n message: '\"Seller contact telephone number\" (BT-42) should contain a valid telephone number. A valid telephone should consist of 3 digits minimum.',\n} as const satisfies SchematronRule;\n\nconst TELEPHONE_REGEX = /.*([0-9].*){3,}.*/;\n\nfunction evaluateDeR027(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const telephone = document.accountingSupplierParty.contact?.telephone;\n return telephone === undefined || TELEPHONE_REGEX.test(telephone.trim());\n}\n\nexport const validateDeR027 = schematronRule(rule, evaluateDeR027);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-028',\n level: 'warning',\n message:\n '\"Seller contact email address\" (BT-43) should contain exactly one @-sign, which should not be framed by a whitespace or a dot but by at least two characters on each side. A dot should not be the first or last character.',\n} as const satisfies SchematronRule;\n\nconst EMAIL_REGEX =\n /^[a-zA-Z0-9!#$%&\"*+/=?^_`{|}~-]+(\\.[a-zA-Z0-9!#$%&\"*+/=?^_`{|}~-]+)*@([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/;\n\nfunction evaluateDeR028(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const email = document.accountingSupplierParty.contact?.electronicMail;\n return email === undefined || EMAIL_REGEX.test(email.trim());\n}\n\nexport const validateDeR028 = schematronRule(rule, evaluateDeR028);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-030',\n level: 'fatal',\n message: 'If the group \"DIRECT DEBIT\" (BG-19) is delivered, the element \"Bank assigned creditor identifier\" (BT-90) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR030(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const hasPaymentMandate = (document.paymentMeans ?? []).some(payment => Boolean(payment.paymentMandate));\n if (!hasPaymentMandate) {\n return true;\n }\n const hasSepaCreditorId =\n document.accountingSupplierParty.partyIdentification?.id?.schemeId === 'SEPA' ||\n document.payeeParty?.partyIdentification?.id?.schemeId === 'SEPA';\n return hasSepaCreditorId;\n}\n\nexport const validateDeR030 = schematronRule(rule, evaluateDeR030);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isGermanSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DE-R-031',\n level: 'fatal',\n message: 'If the group \"DIRECT DEBIT\" (BG-19) is delivered, the element \"Debited account identifier\" (BT-91) shall be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDeR031(document: PeppolDocument): boolean {\n if (!isGermanSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!payment.paymentMandate) {\n return true;\n }\n return Boolean(payment.paymentMandate.payerFinancialAccountId?.id);\n });\n return passed;\n}\n\nexport const validateDeR031 = schematronRule(rule, evaluateDeR031);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'DK-R-002', level: 'fatal', message: 'Danish suppliers MUST provide legal entity (CVR-number)' } as const satisfies SchematronRule;\n\nfunction evaluateDkR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'DK') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId?.id;\n return typeof companyId === 'string' && companyId.trim() !== '';\n}\n\nexport const validateDkR002 = schematronRule(rule, evaluateDkR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-003',\n level: 'warning',\n message: 'If ItemClassification is provided from Danish suppliers, UNSPSC version 19.05.01 or 26.08.01 should be used.',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_VERSIONS = new Set(['19.05.01', '19.0501', '26.08.01', '26.0801']);\n\nfunction evaluateDkR003(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = getLines(document).every(line =>\n (line.item.commodityClassifications ?? []).every(classification => {\n const classificationCode = classification.itemClassification;\n return (\n classificationCode.listId !== 'TST' ||\n (classificationCode.listVersionId !== undefined && ALLOWED_VERSIONS.has(classificationCode.listVersionId))\n );\n })\n );\n return passed;\n}\n\nexport const validateDkR003 = schematronRule(rule, evaluateDkR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-004',\n level: 'fatal',\n message:\n 'When specifying non-VAT Taxes for Danish customers, Danish suppliers MUST use the AllowanceChargeReasonCode=\"ZZZ\" and MUST be specified in AllowanceChargeReason; Either as the 4-digit Tax category or must include a #, but the # is not allowed as first and last character',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR004(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = getAllAllowanceCharges(document).every(ac => {\n if (ac.reasonCode !== 'ZZZ') {\n return true;\n }\n const reason = ac.allowanceChargeReason;\n if (reason === undefined) {\n return false;\n }\n const is4DigitTaxCategory = /^\\d{4}$/.test(reason) && Number(reason) >= 0 && Number(reason) <= 9999;\n const hasHashInside = reason.includes('#') && !reason.startsWith('#') && !reason.endsWith('#');\n return is4DigitTaxCategory || hasHashInside;\n });\n return passed;\n}\n\nexport const validateDkR004 = schematronRule(rule, evaluateDkR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-005',\n level: 'fatal',\n message: 'For Danish suppliers the following Payment means codes are allowed: 1, 10, 31, 42, 48, 49, 50, 58, 59, 93 and 97',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['1', '10', '31', '42', '48', '49', '50', '58', '59', '93', '97']);\n\nfunction evaluateDkR005(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => ALLOWED_CODES.has(payment.paymentMeansCode.code));\n return passed;\n}\n\nexport const validateDkR005 = schematronRule(rule, evaluateDkR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-006',\n level: 'fatal',\n message: 'For Danish suppliers bank account and registration account is mandatory if payment means is 31 or 42',\n} as const satisfies SchematronRule;\n\nconst REQUIRED_CODES = new Set(['31', '42']);\n\nfunction evaluateDkR006(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!REQUIRED_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n const branchId = payment.payeeFinancialAccount?.financialInstitutionBranch?.id;\n return typeof accountId === 'string' && accountId.trim() !== '' && typeof branchId === 'string' && branchId.trim() !== '';\n });\n return passed;\n}\n\nexport const validateDkR006 = schematronRule(rule, evaluateDkR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-007',\n level: 'fatal',\n message: 'For Danish suppliers PaymentMandate/ID and PayerFinancialAccount/ID are mandatory when payment means is 49',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR007(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '49') {\n return true;\n }\n const mandateId = payment.paymentMandate?.id;\n const payerAccountId = payment.paymentMandate?.payerFinancialAccountId?.id;\n return typeof mandateId === 'string' && mandateId.trim() !== '' && typeof payerAccountId === 'string' && payerAccountId.trim() !== '';\n });\n return passed;\n}\n\nexport const validateDkR007 = schematronRule(rule, evaluateDkR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-008',\n level: 'fatal',\n message:\n 'For Danish Suppliers PaymentID is mandatory and MUST start with 01#, 04# or 15# (kortartkode), and PayeeFinancialAccount/ID (Giro kontonummer) is mandatory and must be 7 or 8 numerical characters long, when payment means equals 50 (Giro)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR008(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '50') {\n return true;\n }\n const paymentId = payment.paymentId;\n const giroAccountId = payment.payeeFinancialAccount?.id;\n const startsWithValidPrefix = paymentId ? ['01#', '04#', '15#'].some(prefix => paymentId.startsWith(prefix)) : false;\n return startsWithValidPrefix && typeof giroAccountId === 'string' && /^[0-9]{7,8}$/.test(giroAccountId);\n });\n return passed;\n}\n\nexport const validateDkR008 = schematronRule(rule, evaluateDkR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-009',\n level: 'fatal',\n message:\n 'For Danish Suppliers if the PaymentID is prefixed with 04# or 15# the 16 digits instruction Id must be added to the PaymentID eg. \"04#1234567890123456\" when Payment means equals 50 (Giro)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR009(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '50' || !payment.paymentId) {\n return true;\n }\n const paymentId = payment.paymentId;\n if (paymentId.startsWith('04#') || paymentId.startsWith('15#')) {\n return paymentId.length === 19;\n }\n return true;\n });\n return passed;\n}\n\nexport const validateDkR009 = schematronRule(rule, evaluateDkR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-010',\n level: 'fatal',\n message:\n 'For Danish Suppliers using PaymentMeansCode 93, PaymentID is mandatory. The first three characters of the PaymentID MUST be 71#, 73# or 75# (kortartskode), and PayeeFinancialAccount/ID MUST be exactly 8 characters long.',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR010(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '93') {\n return true;\n }\n const paymentId = payment.paymentId;\n const startsWithValidPrefix = paymentId ? ['71#', '73#', '75#'].some(prefix => paymentId.startsWith(prefix)) : false;\n const accountId = payment.payeeFinancialAccount?.id;\n return startsWithValidPrefix && typeof accountId === 'string' && accountId.length === 8;\n });\n return passed;\n}\n\nexport const validateDkR010 = schematronRule(rule, evaluateDkR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-011',\n level: 'fatal',\n message:\n 'For Danish Suppliers if the PaymentID is prefixed with 71# or 75# the 15-16 digits instruction Id must be added to the PaymentID eg. \"71#1234567890123456\" when payment Method equals 93 (FIK)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR011(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '93' || !payment.paymentId) {\n return true;\n }\n const paymentId = payment.paymentId;\n if (paymentId.startsWith('71#') || paymentId.startsWith('75#')) {\n return paymentId.length === 18 || paymentId.length === 19;\n }\n return true;\n });\n return passed;\n}\n\nexport const validateDkR011 = schematronRule(rule, evaluateDkR011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-013',\n level: 'fatal',\n message:\n 'For Danish Suppliers it is mandatory to use schemeID when PartyIdentification/ID is used for AccountingCustomerParty or AccountingSupplierParty',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR013(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const parties = [document.accountingSupplierParty, document.accountingCustomerParty];\n const passed = parties.every(party => {\n const id = party.partyIdentification?.id;\n return !id?.id || (typeof id.schemeId === 'string' && id.schemeId.trim() !== '');\n });\n return passed;\n}\n\nexport const validateDkR013 = schematronRule(rule, evaluateDkR013);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-014',\n level: 'fatal',\n message:\n 'For Danish Suppliers it is mandatory to specify schemeID as \"0184\" (DK CVR-number) when PartyLegalEntity/CompanyID is used for AccountingSupplierParty',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR014(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'DK') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n const passed = !companyId?.id || companyId.schemeId === '0184';\n return passed;\n}\n\nexport const validateDkR014 = schematronRule(rule, evaluateDkR014);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-016',\n level: 'fatal',\n message: 'For Danish Suppliers, a Credit note cannot have a negative total (PayableAmount)',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR016(document: PeppolDocument): boolean {\n if (!('creditNoteLines' in document) || !isDanishSupplierAndCustomer(document)) {\n return true;\n }\n return document.legalMonetaryTotal.payableAmount.value >= 0;\n}\n\nexport const validateDkR016 = schematronRule(rule, evaluateDkR016);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isDanishSupplierAndCustomer, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'DK-R-017',\n level: 'warning',\n message:\n 'For Danish Customers it is mandatory to specify schemeID as \"0184\" (DK CVR-number) when PartyLegalEntity/CompanyID is used for AccountingCustomerParty',\n} as const satisfies SchematronRule;\n\nfunction evaluateDkR017(document: PeppolDocument): boolean {\n if (!isDanishSupplierAndCustomer(document)) {\n return true;\n }\n const companyId = document.accountingCustomerParty.partyLegalEntity.companyId;\n const passed = !companyId?.id || companyId.schemeId === '0184';\n return passed;\n}\n\nexport const validateDkR017 = schematronRule(rule, evaluateDkR017);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-1',\n level: 'fatal',\n message: ' When the Supplier is Greek, the Invoice Id should consist of 6 segments',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_1(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n return segments.length === 6;\n}\n\nexport const validateGrR001_1 = schematronRule(rule, evaluateGrR001_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-2',\n level: 'fatal',\n message:\n \"When the Supplier is Greek, the Invoice Id first segment must be a valid TIN Number and match either the Supplier's or the Tax Representative's Tin Number\",\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_2(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const firstSegment = segments[0];\n if (!firstSegment || firstSegment.trim().length !== 9) {\n return false;\n }\n const supplierTin = document.accountingSupplierParty.partyTaxSchemes\n ?.find(scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT')\n ?.companyId.slice(2);\n const taxRepTin = document.taxRepresentativeParty?.partyTaxScheme.companyId.slice(2);\n const matchesTin = firstSegment === supplierTin || firstSegment === taxRepTin;\n return greekTinVerification(firstSegment) && matchesTin;\n}\n\nexport const validateGrR001_2 = schematronRule(rule, evaluateGrR001_2);\n","import { DateTime } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-3',\n level: 'fatal',\n message: 'When the Supplier is Greek, the Invoice Id second segment must be a valid Date that matches the invoice Issue Date',\n} as const satisfies SchematronRule;\n\nconst DATE_REGEX = /^(0?[1-9]|[12][0-9]|3[01])[-/]?(0?[1-9]|1[0-2])[-/]?((?:19|20)[0-9]{2})$/;\nconst formatIssueDate = (value: unknown): string => {\n if (typeof value === 'string') {\n return value;\n }\n if (DateTime.isDateTime(value)) {\n return DateTime.formatIsoDate(value);\n }\n return String(value);\n};\n\nfunction evaluateGrR001_3(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const secondSegment = segments[1];\n if (!secondSegment || secondSegment.trim().length === 0) {\n return false;\n }\n const dateMatch = secondSegment.match(DATE_REGEX);\n if (!dateMatch) {\n return false;\n }\n const [, day, month, year] = dateMatch;\n const issueDate = formatIssueDate(document.issueDate);\n const issueDateSegments = issueDate.split('-');\n return day === issueDateSegments[2] && month === issueDateSegments[1] && year === issueDateSegments[0];\n}\n\nexport const validateGrR001_3 = schematronRule(rule, evaluateGrR001_3);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-4',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id third segment must be a positive integer',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_4(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const thirdSegment = segments[2];\n if (!thirdSegment || thirdSegment.trim().length === 0) {\n return false;\n }\n return /^\\d+$/.test(thirdSegment) && Number(thirdSegment) >= 0;\n}\n\nexport const validateGrR001_4 = schematronRule(rule, evaluateGrR001_4);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-5',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id in the fourth segment must be a valid greek document type',\n} as const satisfies SchematronRule;\n\nconst GREEK_DOCUMENT_TYPES = new Set(['1.1', '1.6', '2.1', '2.4', '5.1', '5.2']);\n\nfunction evaluateGrR001_5(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n const fourthSegment = segments[3];\n if (!fourthSegment || fourthSegment.trim().length === 0) {\n return false;\n }\n return GREEK_DOCUMENT_TYPES.has(fourthSegment);\n}\n\nexport const validateGrR001_5 = schematronRule(rule, evaluateGrR001_5);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-6',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id fifth segment must not be empty',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_6(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n return (segments[4]?.length ?? 0) > 0;\n}\n\nexport const validateGrR001_6 = schematronRule(rule, evaluateGrR001_6);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-001-7',\n level: 'fatal',\n message: 'When Supplier is Greek, the Invoice Id sixth segment must not be empty',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR001_7(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const segments = document.id.split('|');\n return (segments[5]?.length ?? 0) > 0;\n}\n\nexport const validateGrR001_7 = schematronRule(rule, evaluateGrR001_7);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-002',\n level: 'fatal',\n message:\n 'Greek Suppliers must provide their full name as they are registered in the Greek Business Registry (G.E.MH.) as a legal entity or in the Tax Registry as a natural person ',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const partyName = document.accountingSupplierParty.partyName?.name;\n return typeof partyName === 'string' && partyName.length > 0;\n}\n\nexport const validateGrR002 = schematronRule(rule, evaluateGrR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-003',\n level: 'fatal',\n message: \"For the Greek Suppliers, the VAT must start with 'EL' and must be a valid TIN number\",\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(\n scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT'\n )?.companyId;\n if (!vatCompanyId) {\n return false;\n }\n return vatCompanyId.startsWith('EL') && greekTinVerification(vatCompanyId.slice(2));\n}\n\nexport const validateGrR003 = schematronRule(rule, evaluateGrR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-004-1',\n level: 'fatal',\n message: ' When Supplier is Greek, there must be one MARK Number',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR004_1(document: PeppolDocument): boolean {\n const isGreek = getSupplierCountry(document) === 'GR' || getSupplierCountry(document) === 'EL';\n if (!isGreek) {\n return true;\n }\n const markCount = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##M.AR.K##').length;\n return markCount === 1;\n}\n\nexport const validateGrR004_1 = schematronRule(rule, evaluateGrR004_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-004-2',\n level: 'fatal',\n message: 'When Supplier is Greek, the MARK Number must be a positive integer',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR004_2(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const markReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##M.AR.K##');\n const passed = markReferences.every(ref => /^[1-9][0-9]*$/.test(ref.id.id));\n return passed;\n}\n\nexport const validateGrR004_2 = schematronRule(rule, evaluateGrR004_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'GR-R-005', level: 'fatal', message: 'Greek Suppliers must provide the full name of the buyer' } as const satisfies SchematronRule;\n\nfunction evaluateGrR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const partyName = document.accountingCustomerParty.partyName?.name;\n return typeof partyName === 'string' && partyName.length > 0;\n}\n\nexport const validateGrR005 = schematronRule(rule, evaluateGrR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-006',\n level: 'fatal',\n message: 'Greek Suppliers must provide the VAT number of the buyer, if the buyer is Greek ',\n} as const satisfies SchematronRule;\n\nconst isGreekCountry = (country: string): boolean => country === 'GR' || country === 'EL';\n\nfunction evaluateGrR006(document: PeppolDocument): boolean {\n if (!isGreekCountry(getSupplierCountry(document)) || !isGreekCountry(getCustomerCountry(document))) {\n return true;\n }\n const vatSchemes = (document.accountingCustomerParty.partyTaxSchemes ?? []).filter(scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT');\n if (vatSchemes.length !== 1) {\n return false;\n }\n const companyId = vatSchemes[0]?.companyId ?? '';\n return companyId.startsWith('EL') && greekTinVerification(companyId.slice(2));\n}\n\nexport const validateGrR006 = schematronRule(rule, evaluateGrR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-008-2',\n level: 'fatal',\n message: 'When Supplier is Greek, there should be no more than one invoice url',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR008_2(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const urlCount = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##INVOICE|URL##').length;\n return urlCount <= 1;\n}\n\nexport const validateGrR008_2 = schematronRule(rule, evaluateGrR008_2);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-008-3',\n level: 'fatal',\n message: 'When Supplier is Greek and the INVOICE URL Document reference exists, the External Reference URI should be present',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR008_3(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const urlReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##INVOICE|URL##');\n const passed = urlReferences.every(ref => {\n const uri = ref.attachment?.externalReference?.uri;\n return typeof uri === 'string' && uri.trim() !== '';\n });\n return passed;\n}\n\nexport const validateGrR008_3 = schematronRule(rule, evaluateGrR008_3);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-009',\n level: 'fatal',\n message:\n 'Greek suppliers that send an invoice through the PEPPOL network must use a correct TIN number as an electronic address according to PEPPOL Electronic Address Identifier scheme (schemeID 9933).',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR009(document: PeppolDocument): boolean {\n const supplierCountry = getSupplierCountry(document);\n if (supplierCountry !== 'GR' && supplierCountry !== 'EL') {\n return true;\n }\n const endpointId = document.accountingSupplierParty.endpointId;\n return endpointId?.schemeId === '9933' && greekTinVerification(endpointId.id);\n}\n\nexport const validateGrR009 = schematronRule(rule, evaluateGrR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { greekTinVerification } from '#/peppol-validations/greek-tin-verification.ts';\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-R-010',\n level: 'fatal',\n message:\n 'Greek Suppliers that send an invoice through the PEPPOL network to a greek buyer must use a correct TIN number as an electronic address according to PEPPOL Electronic Address Identifier scheme (SchemeID 9933)',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrR010(document: PeppolDocument): boolean {\n const isGreekSupplier = getSupplierCountry(document) === 'GR' || getSupplierCountry(document) === 'EL';\n const isGreekCustomer = getCustomerCountry(document) === 'GR' || getCustomerCountry(document) === 'EL';\n if (!isGreekSupplier || !isGreekCustomer) {\n return true;\n }\n const endpointId = document.accountingCustomerParty.endpointId;\n return endpointId?.schemeId === '9933' && greekTinVerification(endpointId.id);\n}\n\nexport const validateGrR010 = schematronRule(rule, evaluateGrR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-S-008-1',\n level: 'warning',\n message: 'When Supplier is Greek, there should be one invoice url',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrS008_1(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const urlCount = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === '##INVOICE|URL##').length;\n return urlCount === 1;\n}\n\nexport const validateGrS008_1 = schematronRule(rule, evaluateGrS008_1);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'GR-S-011',\n level: 'warning',\n message: 'Greek suppliers must provide their Seller Tax Registration Number, prefixed by the country code',\n} as const satisfies SchematronRule;\n\nfunction evaluateGrS011(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'GR' && getSupplierCountry(document) !== 'EL') {\n return true;\n }\n const vatSchemes = document.accountingSupplierParty.partyTaxSchemes?.filter(scheme => scheme.taxSchemeId.id.trim().toUpperCase() === 'VAT') ?? [];\n if (vatSchemes.length !== 1) {\n return false;\n }\n const companyId = vatSchemes[0]?.companyId ?? '';\n return companyId.startsWith('EL');\n}\n\nexport const validateGrS011 = schematronRule(rule, evaluateGrS011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-001',\n level: 'warning',\n message: '[IS-R-001]-If seller is icelandic then invoice type should be 380 or 381',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['380', '381']);\n\nfunction evaluateIsR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const code = 'invoiceTypeCode' in document ? document.invoiceTypeCode : 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n return code !== undefined && !code.includes(' ') && ALLOWED_CODES.has(code);\n}\n\nexport const validateIsR001 = schematronRule(rule, evaluateIsR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-002',\n level: 'fatal',\n message: '[IS-R-002]-If seller is icelandic then it shall contain sellers legal id',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return Boolean(companyId?.id) && companyId?.schemeId === '0196';\n}\n\nexport const validateIsR002 = schematronRule(rule, evaluateIsR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-003',\n level: 'fatal',\n message: '[IS-R-003]-If seller is icelandic then it shall contain his address with street name and zip code',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const address = document.accountingSupplierParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.postalZone);\n}\n\nexport const validateIsR003 = schematronRule(rule, evaluateIsR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-004',\n level: 'fatal',\n message: '[IS-R-004]-If seller and buyer are icelandic then the invoice shall contain the buyers icelandic legal identifier',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS' || getCustomerCountry(document) !== 'IS') {\n return true;\n }\n const companyId = document.accountingCustomerParty.partyLegalEntity.companyId;\n return Boolean(companyId?.id) && companyId?.schemeId === '0196';\n}\n\nexport const validateIsR004 = schematronRule(rule, evaluateIsR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-005',\n level: 'fatal',\n message: '[IS-R-005]-If seller and buyer are icelandic then the invoice shall contain the buyers address with street name and zip code',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS' || getCustomerCountry(document) !== 'IS') {\n return true;\n }\n const address = document.accountingCustomerParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.postalZone);\n}\n\nexport const validateIsR005 = schematronRule(rule, evaluateIsR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-006',\n level: 'fatal',\n message: '[IS-R-006]-If seller is icelandic and payment means code is 9 then a 12 digit account id must exist',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR006(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const code9Payments = (document.paymentMeans ?? []).filter(payment => payment.paymentMeansCode.code === '9');\n if (code9Payments.length === 0) {\n return true;\n }\n const passed = code9Payments.every(payment => {\n const accountId = payment.payeeFinancialAccount?.id;\n return typeof accountId === 'string' && accountId.trim().length === 12;\n });\n return passed;\n}\n\nexport const validateIsR006 = schematronRule(rule, evaluateIsR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-007',\n level: 'fatal',\n message: '[IS-R-007]-If seller is icelandic and payment means code is 42 then a 12 digit account id must exist',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR007(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const code42Payments = (document.paymentMeans ?? []).filter(payment => payment.paymentMeansCode.code === '42');\n if (code42Payments.length === 0) {\n return true;\n }\n const passed = code42Payments.every(payment => {\n const accountId = payment.payeeFinancialAccount?.id;\n return typeof accountId === 'string' && accountId.trim().length === 12;\n });\n return passed;\n}\n\nexport const validateIsR007 = schematronRule(rule, evaluateIsR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-008',\n level: 'fatal',\n message: '[IS-R-008]-If seller is icelandic and invoice contains supporting description EINDAGI then the id form must be YYYY-MM-DD',\n} as const satisfies SchematronRule;\n\nconst DATE_REGEX = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nfunction evaluateIsR008(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const eindagiReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === 'EINDAGI');\n if (eindagiReferences.length === 0) {\n return true;\n }\n const passed = eindagiReferences.every(ref => {\n const id = ref.id.id;\n return id.length === 10 && DATE_REGEX.test(id) && !Number.isNaN(Date.parse(id));\n });\n return passed;\n}\n\nexport const validateIsR008 = schematronRule(rule, evaluateIsR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-009',\n level: 'fatal',\n message: '[IS-R-009]-If seller is icelandic and invoice contains supporting description EINDAGI invoice must have due date',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR009(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const hasEindagi = (document.additionalDocumentReferences ?? []).some(ref => ref.documentDescription === 'EINDAGI');\n if (!hasEindagi) {\n return true;\n }\n return Boolean(document.dueDate);\n}\n\nexport const validateIsR009 = schematronRule(rule, evaluateIsR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IS-R-010',\n level: 'fatal',\n message: '[IS-R-010]-If seller is icelandic and invoice contains supporting description EINDAGI the id date must be same or later than due date',\n} as const satisfies SchematronRule;\n\nfunction evaluateIsR010(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IS') {\n return true;\n }\n const eindagiReferences = (document.additionalDocumentReferences ?? []).filter(ref => ref.documentDescription === 'EINDAGI');\n if (eindagiReferences.length === 0) {\n return true;\n }\n const dueDate = document.dueDate;\n if (!dueDate) {\n return false;\n }\n const passed = eindagiReferences.every(ref => {\n const id = ref.id.id;\n return id >= dueDate;\n });\n return passed;\n}\n\nexport const validateIsR010 = schematronRule(rule, evaluateIsR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-001',\n level: 'fatal',\n message: '[IT-R-001] BT-32 (Seller tax registration identifier) - For Italian suppliers BT-32 minimum length 11 and maximum length shall be 16.',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const companyIds =\n document.accountingSupplierParty.partyTaxSchemes?.filter(scheme => scheme.taxSchemeId.id !== 'VAT').map(scheme => scheme.companyId) ?? [];\n const passed = companyIds.every(id => /^[A-Z0-9]{11,16}$/.test(id));\n return passed;\n}\n\nexport const validateItR001 = schematronRule(rule, evaluateItR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-002',\n level: 'fatal',\n message: '[IT-R-002] BT-35 (Seller address line 1) - Italian suppliers MUST provide the postal address line 1',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const streetName = document.accountingSupplierParty.postalAddress.streetName;\n return typeof streetName === 'string' && streetName.trim() !== '';\n}\n\nexport const validateItR002 = schematronRule(rule, evaluateItR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-003',\n level: 'fatal',\n message: '[IT-R-003] BT-37 (Seller city) - Italian suppliers MUST provide the postal address city',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const cityName = document.accountingSupplierParty.postalAddress.cityName;\n return typeof cityName === 'string' && cityName.trim() !== '';\n}\n\nexport const validateItR003 = schematronRule(rule, evaluateItR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'IT-R-004',\n level: 'fatal',\n message: '[IT-R-004] BT-38 (Seller post code) - Italian suppliers MUST provide the postal address post code',\n} as const satisfies SchematronRule;\n\nfunction evaluateItR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'IT') {\n return true;\n }\n const postalZone = document.accountingSupplierParty.postalAddress.postalZone;\n return typeof postalZone === 'string' && postalZone.trim() !== '';\n}\n\nexport const validateItR004 = schematronRule(rule, evaluateItR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-001',\n level: 'fatal',\n message:\n '[NL-R-001] For suppliers in the Netherlands, if the document is a creditnote, the document MUST contain an invoice reference (cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID)',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || !('creditNoteTypeCode' in document)) {\n return true;\n }\n const invoiceReference = document.billingReferences?.some(ref => Boolean(ref.invoiceDocumentReference.id));\n return Boolean(invoiceReference);\n}\n\nexport const validateNlR001 = schematronRule(rule, evaluateNlR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-002',\n level: 'fatal',\n message:\n \"[NL-R-002] For suppliers in the Netherlands the supplier's address (cac:AccountingSupplierParty/cac:Party/cac:PostalAddress) MUST contain street name (cbc:StreetName), city (cbc:CityName) and post code (cbc:PostalZone)\",\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const address = document.accountingSupplierParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.cityName) && Boolean(address.postalZone);\n}\n\nexport const validateNlR002 = schematronRule(rule, evaluateNlR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-003',\n level: 'fatal',\n message: '[NL-R-003] For suppliers in the Netherlands, the legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_SCHEMES = new Set(['0106', '0190']);\n\nfunction evaluateNlR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n if (!companyId?.id) {\n return true;\n }\n return Boolean(companyId.schemeId && ALLOWED_SCHEMES.has(companyId.schemeId));\n}\n\nexport const validateNlR003 = schematronRule(rule, evaluateNlR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-004',\n level: 'fatal',\n message:\n '[NL-R-004] For suppliers in the Netherlands, if the customer is in the Netherlands, the customer address (cac:AccountingCustomerParty/cac:Party/cac:PostalAddress) MUST contain the street name (cbc:StreetName), the city (cbc:CityName) and post code (cbc:PostalZone)',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || getCustomerCountry(document) !== 'NL') {\n return true;\n }\n const address = document.accountingCustomerParty.postalAddress;\n return Boolean(address.streetName) && Boolean(address.cityName) && Boolean(address.postalZone);\n}\n\nexport const validateNlR004 = schematronRule(rule, evaluateNlR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-005',\n level: 'fatal',\n message:\n \"[NL-R-005] For suppliers in the Netherlands, if the customer is in the Netherlands, the customer's legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)\",\n} as const satisfies SchematronRule;\n\nconst ALLOWED_SCHEMES = new Set(['0106', '0190']);\n\nfunction evaluateNlR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || getCustomerCountry(document) !== 'NL') {\n return true;\n }\n const companyId = document.accountingCustomerParty.partyLegalEntity.companyId;\n if (!companyId?.id) {\n return true;\n }\n return Boolean(companyId.schemeId && ALLOWED_SCHEMES.has(companyId.schemeId));\n}\n\nexport const validateNlR005 = schematronRule(rule, evaluateNlR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-006',\n level: 'fatal',\n message:\n \"[NL-R-006] For suppliers in the Netherlands, if the fiscal representative is in the Netherlands, the representative's address (cac:TaxRepresentativeParty/cac:PostalAddress) MUST contain street name (cbc:StreetName), city (cbc:CityName) and post code (cbc:PostalZone)\",\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR006(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const taxRep = document.taxRepresentativeParty;\n if (!taxRep || taxRep.postalAddress.countryCode.identificationCode.toUpperCase() !== 'NL') {\n return true;\n }\n const address = taxRep.postalAddress;\n return Boolean(address.streetName) && Boolean(address.cityName) && Boolean(address.postalZone);\n}\n\nexport const validateNlR006 = schematronRule(rule, evaluateNlR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-007',\n level: 'fatal',\n message:\n '[NL-R-007] For suppliers in the Netherlands, the supplier MUST provide a means of payment (cac:PaymentMeans) if the payment is from customer to supplier',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR007(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const payable = document.legalMonetaryTotal.payableAmount.value;\n const isInvoice = 'invoiceLines' in document;\n const isCreditNote = 'creditNoteLines' in document;\n if ((isInvoice && payable <= 0) || (isCreditNote && payable >= 0)) {\n return true;\n }\n return (document.paymentMeans?.length ?? 0) > 0;\n}\n\nexport const validateNlR007 = schematronRule(rule, evaluateNlR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-008',\n level: 'fatal',\n message:\n '[NL-R-008] For suppliers in the Netherlands, if the customer is in the Netherlands, the payment means code (cac:PaymentMeans/cbc:PaymentMeansCode) MUST be one of 30, 48, 49, 57, 58 or 59',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_CODES = new Set(['30', '48', '49', '57', '58', '59']);\n\nfunction evaluateNlR008(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL' || getCustomerCountry(document) !== 'NL') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => ALLOWED_CODES.has(payment.paymentMeansCode.code));\n return passed;\n}\n\nexport const validateNlR008 = schematronRule(rule, evaluateNlR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NL-R-009',\n level: 'fatal',\n message:\n '[NL-R-009] For suppliers in the Netherlands, if an order line reference (cac:OrderLineReference/cbc:LineID) is used, there must be an order reference on the document level (cac:OrderReference/cbc:ID)',\n} as const satisfies SchematronRule;\n\nfunction evaluateNlR009(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NL') {\n return true;\n }\n const hasOrderLineReference = getLines(document).some(line => Boolean(line.orderLineReference?.lineId));\n if (!hasOrderLineReference) {\n return true;\n }\n return Boolean(document.orderReference?.id);\n}\n\nexport const validateNlR009 = schematronRule(rule, evaluateNlR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidMod11 } from '#/peppol-validations/is-valid-mod11.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NO-R-001',\n level: 'fatal',\n message:\n 'For Norwegian suppliers, a VAT number MUST be the country code prefix NO followed by a valid Norwegian organization number (nine numbers) followed by the letters MVA.',\n} as const satisfies SchematronRule;\n\nfunction evaluateNoR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NO') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'VAT')?.companyId;\n if (!vatCompanyId || vatCompanyId.slice(0, 2) !== 'NO') {\n return true;\n }\n const orgNumber = vatCompanyId.slice(2);\n const passed = /^[0-9]{9}MVA$/.test(orgNumber) && isValidMod11(orgNumber.slice(0, 9));\n return passed;\n}\n\nexport const validateNoR001 = schematronRule(rule, evaluateNoR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'NO-R-002',\n level: 'warning',\n message: 'For Norwegian suppliers, most invoice issuers are required to append \"Foretaksregisteret\" to their invoice.',\n} as const satisfies SchematronRule;\n\nfunction evaluateNoR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'NO') {\n return true;\n }\n const taxCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'TAX')?.companyId;\n return taxCompanyId === 'Foretaksregisteret';\n}\n\nexport const validateNoR002 = schematronRule(rule, evaluateNoR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\nimport { mimeCodesKeys } from '#/values/mime-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL001',\n level: 'fatal',\n message: 'Mime code must be according to subset of IANA code list.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL001(document: PeppolDocument): boolean {\n const mimeCodes = (document.additionalDocumentReferences ?? []).flatMap(ref => {\n const binary = ref.attachment?.embeddedDocumentBinaryObject;\n return binary ? [binary.mimeCode] : [];\n });\n const passed = mimeCodes.every(code => (mimeCodesKeys as ReadonlyArray<string>).includes(code));\n return passed;\n}\n\nexport const validatePeppolEn16931CL001 = schematronRule(rule, evaluatePeppolEn16931CL001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\nimport { allowanceChargeReasonCodesKeys } from '#/values/allowance-charge-reason-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL002',\n level: 'fatal',\n message: 'Reason code MUST be according to subset of UNCL 5189 D.16B.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL002(document: PeppolDocument): boolean {\n const allowances = getAllAllowanceCharges(document).filter(ac => !ac.chargeIndicator);\n const passed = allowances.every(\n ac => ac.reasonCode === undefined || (allowanceChargeReasonCodesKeys as ReadonlyArray<string>).includes(ac.reasonCode)\n );\n return passed;\n}\n\nexport const validatePeppolEn16931CL002 = schematronRule(rule, evaluatePeppolEn16931CL002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\nimport { chargeReasonCodesKeys } from '#/values/charge-reason-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL003',\n level: 'fatal',\n message: 'Reason code MUST be according to UNCL 7161 D.16B.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL003(document: PeppolDocument): boolean {\n const charges = getAllAllowanceCharges(document).filter(ac => ac.chargeIndicator);\n const passed = charges.every(ac => ac.reasonCode === undefined || (chargeReasonCodesKeys as ReadonlyArray<string>).includes(ac.reasonCode));\n return passed;\n}\n\nexport const validatePeppolEn16931CL003 = schematronRule(rule, evaluatePeppolEn16931CL003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\nimport { vatDateCodesKeys } from '#/values/vat-dates.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL006',\n level: 'fatal',\n message: 'Invoice period description code must be according to UNCL 2005 D.16B.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL006(document: PeppolDocument): boolean {\n const descriptionCode = document.invoicePeriod?.descriptionCode;\n if (descriptionCode === undefined) {\n return true;\n }\n return (vatDateCodesKeys as ReadonlyArray<string>).includes(descriptionCode);\n}\n\nexport const validatePeppolEn16931CL006 = schematronRule(rule, evaluatePeppolEn16931CL006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\nimport { currencyCodesKeys } from '#/values/currency-code.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL007',\n level: 'fatal',\n message: 'Currency code must be according to ISO 4217:2005',\n} as const satisfies SchematronRule;\n\nconst isValidCurrency = (code: string): boolean => (currencyCodesKeys as ReadonlyArray<string>).includes(code);\n\nconst collectCurrencies = (document: PeppolDocument): Array<string> => {\n const total = document.legalMonetaryTotal;\n const optionalTotalCurrencies = [\n total.allowanceTotalAmount?.currencyId,\n total.chargeTotalAmount?.currencyId,\n total.prepaidAmount?.currencyId,\n total.payableRoundingAmount?.currencyId,\n ].filter((code): code is string => code !== undefined);\n\n return [\n document.documentCurrencyCode,\n ...(document.taxCurrencyCode ? [document.taxCurrencyCode] : []),\n ...getLines(document).flatMap(line => [line.lineExtensionAmount.currencyId, line.price.priceAmount.currencyId]),\n total.lineExtensionAmount.currencyId,\n total.taxExclusiveAmount.currencyId,\n total.taxInclusiveAmount.currencyId,\n total.payableAmount.currencyId,\n ...optionalTotalCurrencies,\n ...document.taxTotals.flatMap(taxTotal => [\n taxTotal.taxAmount.currencyId,\n ...(taxTotal.taxSubtotals ?? []).flatMap(subtotal => [subtotal.taxAmount.currencyId, subtotal.taxableAmount.currencyId]),\n ]),\n ];\n};\n\nfunction evaluatePeppolEn16931CL007(document: PeppolDocument): boolean {\n return collectCurrencies(document).every(isValidCurrency);\n}\n\nexport const validatePeppolEn16931CL007 = schematronRule(rule, evaluatePeppolEn16931CL007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\nimport { electronicAddressCodesKeys } from '#/values/eas-codes.generated';\n\nconst rule = {\n id: 'PEPPOL-EN16931-CL008',\n level: 'fatal',\n message: 'Electronic address identifier scheme must be from the codelist \"Electronic Address Identifier Scheme\"',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931CL008(document: PeppolDocument): boolean {\n const schemeIds: Array<string | undefined> = [\n document.accountingSupplierParty.endpointId?.schemeId,\n document.accountingCustomerParty.endpointId?.schemeId,\n ];\n const passed = schemeIds.every(schemeId => schemeId === undefined || (electronicAddressCodesKeys as ReadonlyArray<string>).includes(schemeId));\n return passed;\n}\n\nexport const validatePeppolEn16931CL008 = schematronRule(rule, evaluatePeppolEn16931CL008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidGLN } from '#/peppol-validations/is-valid-gln.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R040',\n level: 'fatal',\n message: 'GLN must have a valid format according to GS1 rules.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0088';\n\nfunction evaluatePeppolCommonR040(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]+$/.test(normalizeSpace(i.id)) && isValidGLN(normalizeSpace(i.id)).success);\n return passed;\n}\n\nexport const validatePeppolCommonR040 = schematronRule(rule, evaluatePeppolCommonR040);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidMod11 } from '#/peppol-validations/is-valid-mod11.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R041',\n level: 'fatal',\n message: 'Norwegian organization number MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0192';\n\nfunction evaluatePeppolCommonR041(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]{9}$/.test(normalizeSpace(i.id)) && isValidMod11(normalizeSpace(i.id)));\n return passed;\n}\n\nexport const validatePeppolCommonR041 = schematronRule(rule, evaluatePeppolCommonR041);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R042',\n level: 'fatal',\n message: 'Danish organization number (CVR) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0184';\n\nfunction evaluatePeppolCommonR042(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => {\n const value = i.id;\n const isDkPrefixed = value.length === 10 && value.startsWith('DK') && value.slice(2).replace(/[0-9]/g, '').length === 0;\n const isDigitsOnly = value.length === 8 && value.replace(/[0-9]/g, '').length === 0;\n return isDkPrefixed || isDigitsOnly;\n });\n return passed;\n}\n\nexport const validatePeppolCommonR042 = schematronRule(rule, evaluatePeppolCommonR042);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidMod97_0208 } from '#/peppol-validations/is-valid-mod97-0208.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R043',\n level: 'fatal',\n message: 'Belgian enterprise number MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0208';\n\nfunction evaluatePeppolCommonR043(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]{10}$/.test(normalizeSpace(i.id)) && isValidMod97_0208(normalizeSpace(i.id)).success);\n return passed;\n}\n\nexport const validatePeppolCommonR043 = schematronRule(rule, evaluatePeppolCommonR043);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R044',\n level: 'warning',\n message: 'IPA Code (Codice Univoco Unità Organizzativa) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0201';\nconst ALLOWED_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n\nfunction evaluatePeppolCommonR044(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.length === 6 && i.id.split('').every(c => ALLOWED_CHARACTERS.includes(c)));\n return passed;\n}\n\nexport const validatePeppolCommonR044 = schematronRule(rule, evaluatePeppolCommonR044);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkCF } from '#/peppol-validations/check-cf.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R045',\n level: 'warning',\n message: 'Tax Code (Codice Fiscale) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0210';\n\nfunction evaluatePeppolCommonR045(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => checkCF(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR045 = schematronRule(rule, evaluatePeppolCommonR045);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkCF } from '#/peppol-validations/check-cf.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R046',\n level: 'warning',\n message: 'Tax Code (Codice Fiscale) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '9907';\n\nfunction evaluatePeppolCommonR046(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => checkCF(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR046 = schematronRule(rule, evaluatePeppolCommonR046);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkPIVAseIT } from '#/peppol-validations/check-piva-se-it.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R047',\n level: 'warning',\n message: 'Italian VAT Code (Partita Iva) must be stated in the correct format',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0211';\n\nfunction evaluatePeppolCommonR047(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => checkPIVAseIT(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR047 = schematronRule(rule, evaluatePeppolCommonR047);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkSEOrgnr } from '#/peppol-validations/check-se-orgnr.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R049',\n level: 'fatal',\n message: 'Swedish organization number MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0007';\n\nfunction evaluatePeppolCommonR049(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.trim().length === 10 && Number.isFinite(Number(i.id.trim())) && checkSEOrgnr(i.id));\n return passed;\n}\n\nexport const validatePeppolCommonR049 = schematronRule(rule, evaluatePeppolCommonR049);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isValidABN } from '#/peppol-validations/is-valid-abn.ts';\nimport { normalizeSpace } from '#/peppol-validations/normalize-space.ts';\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R050',\n level: 'fatal',\n message: 'Australian Business Number (ABN) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0151';\n\nfunction evaluatePeppolCommonR050(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => /^[0-9]{11}$/.test(normalizeSpace(i.id)) && isValidABN(normalizeSpace(i.id)));\n return passed;\n}\n\nexport const validatePeppolCommonR050 = schematronRule(rule, evaluatePeppolCommonR050);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R052',\n level: 'warning',\n message: 'Danish chamber of commerce number (P) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0096';\n\nfunction evaluatePeppolCommonR052(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.length === 10 && i.id.replace(/[0-9]/g, '').length === 0);\n return passed;\n}\n\nexport const validatePeppolCommonR052 = schematronRule(rule, evaluatePeppolCommonR052);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getIdentifiersWithSchemeId, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-COMMON-R053',\n level: 'warning',\n message: 'Danish ERSTORG number (SE) MUST be stated in the correct format.',\n} as const satisfies SchematronRule;\n\nconst SCHEME_ID = '0198';\n\nfunction evaluatePeppolCommonR053(document: PeppolDocument): boolean {\n const identifiers = getIdentifiersWithSchemeId(document).filter(i => i.schemeId === SCHEME_ID);\n const passed = identifiers.every(i => i.id.length === 10 && i.id.startsWith('DK') && i.id.slice(2).replace(/[0-9]/g, '').length === 0);\n return passed;\n}\n\nexport const validatePeppolCommonR053 = schematronRule(rule, evaluatePeppolCommonR053);\n","import { DateTime, Predicate, Schema } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { PeppolIsoDateString } from '#/schemas/peppol-iso-date-string.ts';\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-F001', level: 'fatal', message: 'A date MUST be formatted YYYY-MM-DD.' } as const satisfies SchematronRule;\n\nconst DATE_REGEX = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst isValidDate = (value: string | undefined): boolean => value === undefined || (DATE_REGEX.test(value) && !Number.isNaN(Date.parse(value)));\n\nconst formatDate = (value: PeppolIsoDateString | string): string => {\n if (typeof value === 'string') {\n return value;\n }\n return DateTime.formatIsoDate(value);\n};\nconst isDate = Schema.is(PeppolIsoDateString);\n\nconst collectDates = (document: PeppolDocument): Array<string> => {\n const optionalDates = [\n document.taxPointDate,\n document.invoicePeriod?.startDate,\n document.invoicePeriod?.endDate,\n document.delivery?.actualDeliveryDate,\n ...getLines(document).flatMap(line => [line.invoicePeriod?.startDate, line.invoicePeriod?.endDate]),\n ].filter((date): date is string => date !== undefined);\n\n const dates = [document.issueDate, ...optionalDates].map(date => formatDate(date));\n if (Predicate.hasProperty(document, 'dueDate') && isDate(document.dueDate)) {\n dates.push(formatDate(document.dueDate));\n }\n return dates;\n};\n\nfunction evaluatePeppolEn16931F001(document: PeppolDocument): boolean {\n return collectDates(document).every(isValidDate);\n}\n\nexport const validatePeppolEn16931F001 = schematronRule(rule, evaluatePeppolEn16931F001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getProfile, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0100',\n level: 'fatal',\n message: 'Invoice type code MUST be set according to the profile.',\n} as const satisfies SchematronRule;\n\nconst PROFILE_01_INVOICE_TYPE_CODES = new Set([\n '71',\n '80',\n '82',\n '84',\n '102',\n '218',\n '219',\n '326',\n '331',\n '380',\n '382',\n '383',\n '384',\n '386',\n '388',\n '393',\n '395',\n '553',\n '575',\n '623',\n '780',\n '817',\n '870',\n '875',\n '876',\n '877',\n]);\n\nfunction evaluatePeppolEn16931P0100(document: PeppolDocument): boolean {\n const invoiceTypeCode = 'invoiceTypeCode' in document ? document.invoiceTypeCode : undefined;\n if (invoiceTypeCode === undefined) {\n return true;\n }\n const profile = getProfile(document);\n if (profile === 'Unknown' || profile !== '01') {\n return true;\n }\n return PROFILE_01_INVOICE_TYPE_CODES.has(invoiceTypeCode);\n}\n\nexport const validatePeppolEn16931P0100 = schematronRule(rule, evaluatePeppolEn16931P0100);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getProfile, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0101',\n level: 'fatal',\n message: 'Credit note type code MUST be set according to the profile.',\n} as const satisfies SchematronRule;\n\nconst PROFILE_01_CREDIT_NOTE_TYPE_CODES = new Set(['381', '396', '81', '83', '532']);\n\nfunction evaluatePeppolEn16931P0101(document: PeppolDocument): boolean {\n const creditNoteTypeCode = 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n if (creditNoteTypeCode === undefined) {\n return true;\n }\n const profile = getProfile(document);\n if (profile === 'Unknown' || profile !== '01') {\n return true;\n }\n return PROFILE_01_CREDIT_NOTE_TYPE_CODES.has(creditNoteTypeCode);\n}\n\nexport const validatePeppolEn16931P0101 = schematronRule(rule, evaluatePeppolEn16931P0101);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0104',\n level: 'fatal',\n message: 'Tax Category G MUST be used when exemption reason code is VATEX-EU-G',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0104(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-G' || category.id === 'G');\n return passed;\n}\n\nexport const validatePeppolEn16931P0104 = schematronRule(rule, evaluatePeppolEn16931P0104);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0105',\n level: 'fatal',\n message: 'Tax Category O MUST be used when exemption reason code is VATEX-EU-O',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0105(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-O' || category.id === 'O');\n return passed;\n}\n\nexport const validatePeppolEn16931P0105 = schematronRule(rule, evaluatePeppolEn16931P0105);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0106',\n level: 'fatal',\n message: 'Tax Category K MUST be used when exemption reason code is VATEX-EU-IC',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0106(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-IC' || category.id === 'K');\n return passed;\n}\n\nexport const validatePeppolEn16931P0106 = schematronRule(rule, evaluatePeppolEn16931P0106);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0107',\n level: 'fatal',\n message: 'Tax Category AE MUST be used when exemption reason code is VATEX-EU-AE',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0107(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-AE' || category.id === 'AE');\n return passed;\n}\n\nexport const validatePeppolEn16931P0107 = schematronRule(rule, evaluatePeppolEn16931P0107);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0108',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-D',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0108(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-D' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0108 = schematronRule(rule, evaluatePeppolEn16931P0108);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0109',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-F',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0109(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-F' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0109 = schematronRule(rule, evaluatePeppolEn16931P0109);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0110',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-I',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0110(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-I' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0110 = schematronRule(rule, evaluatePeppolEn16931P0110);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0111',\n level: 'fatal',\n message: 'Tax Category E MUST be used when exemption reason code is VATEX-EU-J',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931P0111(document: PeppolDocument): boolean {\n const taxCategories = document.taxTotals.flatMap(total => (total.taxSubtotals ?? []).map(subtotal => subtotal.taxCategory));\n const passed = taxCategories.every(category => category.taxExemptionReasonCode?.toUpperCase() !== 'VATEX-EU-J' || category.id === 'E');\n return passed;\n}\n\nexport const validatePeppolEn16931P0111 = schematronRule(rule, evaluatePeppolEn16931P0111);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { isCustomerGermany, isSupplierGermany, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-P0112',\n level: 'fatal',\n message: 'Invoice type code 326 or 384 are only allowed when both buyer and seller are German organizations ',\n} as const satisfies SchematronRule;\n\nconst GERMAN_ONLY_CODES = new Set(['326', '384']);\n\nfunction evaluatePeppolEn16931P0112(document: PeppolDocument): boolean {\n const invoiceTypeCode = 'invoiceTypeCode' in document ? document.invoiceTypeCode : undefined;\n const creditNoteTypeCode = 'creditNoteTypeCode' in document ? document.creditNoteTypeCode : undefined;\n const code = invoiceTypeCode ?? creditNoteTypeCode;\n if (!code || !GERMAN_ONLY_CODES.has(code)) {\n return true;\n }\n return isSupplierGermany(document) && isCustomerGermany(document);\n}\n\nexport const validatePeppolEn16931P0112 = schematronRule(rule, evaluatePeppolEn16931P0112);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R001', level: 'fatal', message: 'Business process MUST be provided.' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R001(document: PeppolDocument): boolean {\n return typeof document.profileId === 'string' && document.profileId.trim() !== '';\n}\n\nexport const validatePeppolEn16931R001 = schematronRule(rule, evaluatePeppolEn16931R001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R002',\n level: 'fatal',\n message: 'No more than one note is allowed on document level, unless both the buyer and seller are German organizations.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R002(document: PeppolDocument): boolean {\n const noteCount = typeof document.note === 'string' ? 1 : 0;\n return noteCount <= 1;\n}\n\nexport const validatePeppolEn16931R002 = schematronRule(rule, evaluatePeppolEn16931R002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R003',\n level: 'fatal',\n message: 'A buyer reference or purchase order reference MUST be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R003(document: PeppolDocument): boolean {\n const passed = typeof document.buyerReference === 'string' && document.buyerReference.trim() !== '' ? true : Boolean(document.orderReference?.id);\n return passed;\n}\n\nexport const validatePeppolEn16931R003 = schematronRule(rule, evaluatePeppolEn16931R003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R004',\n level: 'fatal',\n message: \"Specification identifier MUST have the value 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0'.\",\n} as const satisfies SchematronRule;\n\nconst CUSTOMIZATION_ID_PREFIX = 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0';\n\nfunction evaluatePeppolEn16931R004(document: PeppolDocument): boolean {\n const customizationId = typeof document.customizationId === 'string' ? document.customizationId.trim() : '';\n return customizationId.startsWith(CUSTOMIZATION_ID_PREFIX);\n}\n\nexport const validatePeppolEn16931R004 = schematronRule(rule, evaluatePeppolEn16931R004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R005',\n level: 'fatal',\n message: 'VAT accounting currency code MUST be different from invoice currency code when provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R005(document: PeppolDocument): boolean {\n if (!document.taxCurrencyCode) {\n return true;\n }\n return document.taxCurrencyCode !== document.documentCurrencyCode;\n}\n\nexport const validatePeppolEn16931R005 = schematronRule(rule, evaluatePeppolEn16931R005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getProfile, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R007',\n level: 'fatal',\n message: \"Business process MUST be in the format 'urn:fdc:peppol.eu:2017:poacc:billing:NN:1.0' where NN indicates the process number.\",\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R007(document: PeppolDocument): boolean {\n return getProfile(document) !== 'Unknown';\n}\n\nexport const validatePeppolEn16931R007 = schematronRule(rule, evaluatePeppolEn16931R007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R008', level: 'fatal', message: 'Document MUST not contain empty elements.' } as const satisfies SchematronRule;\n\nfunction containsEmptyElement(value: unknown): boolean {\n if (value === null || value === undefined) {\n return false;\n }\n if (typeof value === 'string') {\n return value.trim() === '';\n }\n if (Array.isArray(value)) {\n return value.some(containsEmptyElement);\n }\n if (typeof value === 'object') {\n return Object.values(value as Record<string, unknown>).some(containsEmptyElement);\n }\n return false;\n}\n\nfunction evaluatePeppolEn16931R008(document: PeppolDocument): boolean {\n return !containsEmptyElement(document);\n}\n\nexport const validatePeppolEn16931R008 = schematronRule(rule, evaluatePeppolEn16931R008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R010', level: 'fatal', message: 'Buyer electronic address MUST be provided' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R010(document: PeppolDocument): boolean {\n const endpointId = document.accountingCustomerParty.endpointId?.id;\n return typeof endpointId === 'string' && endpointId.trim() !== '';\n}\n\nexport const validatePeppolEn16931R010 = schematronRule(rule, evaluatePeppolEn16931R010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R020', level: 'fatal', message: 'Seller electronic address MUST be provided' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R020(document: PeppolDocument): boolean {\n const endpointId = document.accountingSupplierParty.endpointId?.id;\n return typeof endpointId === 'string' && endpointId.trim() !== '';\n}\n\nexport const validatePeppolEn16931R020 = schematronRule(rule, evaluatePeppolEn16931R020);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule, slack } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R040',\n level: 'fatal',\n message: 'Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R040(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => {\n if (!ac.multiplierFactorNumeric || ac.baseAmount === undefined) {\n return true;\n }\n const expected = (ac.baseAmount * ac.multiplierFactorNumeric) / 100;\n return slack(expected, ac.amount ?? 0, 0.02);\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R040 = schematronRule(rule, evaluatePeppolEn16931R040);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R041',\n level: 'fatal',\n message: 'Allowance/charge base amount MUST be provided when allowance/charge percentage is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R041(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => !ac.multiplierFactorNumeric || ac.baseAmount !== undefined);\n return passed;\n}\n\nexport const validatePeppolEn16931R041 = schematronRule(rule, evaluatePeppolEn16931R041);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R042',\n level: 'fatal',\n message: 'Allowance/charge percentage MUST be provided when allowance/charge base amount is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R042(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => ac.baseAmount === undefined || Boolean(ac.multiplierFactorNumeric));\n return passed;\n}\n\nexport const validatePeppolEn16931R042 = schematronRule(rule, evaluatePeppolEn16931R042);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getAllAllowanceCharges, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R043',\n level: 'fatal',\n message: \"Allowance/charge ChargeIndicator value MUST equal 'true' or 'false'\",\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R043(document: PeppolDocument): boolean {\n const allowanceCharges = getAllAllowanceCharges(document);\n const passed = allowanceCharges.every(ac => typeof ac.chargeIndicator === 'boolean');\n return passed;\n}\n\nexport const validatePeppolEn16931R043 = schematronRule(rule, evaluatePeppolEn16931R043);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R044',\n level: 'fatal',\n message: \"Charge on price level is NOT allowed. Only value 'false' allowed.\",\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R044(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => !line.price.allowanceCharge || !line.price.allowanceCharge.chargeIndicator);\n return passed;\n}\n\nexport const validatePeppolEn16931R044 = schematronRule(rule, evaluatePeppolEn16931R044);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule, slack } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R046',\n level: 'fatal',\n message: 'Item net price MUST equal (Gross price - Allowance amount) when gross price is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R046(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const price = line.price;\n const allowance = price.allowanceCharge;\n if (!allowance || allowance.baseAmount === undefined) {\n return true;\n }\n return slack(allowance.baseAmount.value - (allowance.amount?.value ?? 0), price.priceAmount.value, 0.02);\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R046 = schematronRule(rule, evaluatePeppolEn16931R046);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R051',\n level: 'fatal',\n message:\n 'All currencyID attributes must have the same value as the invoice currency code (BT-5), except for the invoice total VAT amount in accounting currency (BT-111).',\n} as const satisfies SchematronRule;\n\ninterface CurrencyAmount {\n currencyId: string;\n}\n\ninterface AllowanceChargeAmounts {\n amount?: CurrencyAmount | undefined;\n baseAmount?: CurrencyAmount | undefined;\n}\n\nconst matchesCurrency = (amount: CurrencyAmount | undefined, expected: string): boolean => amount?.currencyId === expected;\n\nconst optionalMatchesCurrency = (amount: CurrencyAmount | undefined, expected: string): boolean =>\n amount === undefined || matchesCurrency(amount, expected);\n\nconst allowanceChargeMatchesCurrency = (allowanceCharge: AllowanceChargeAmounts, expected: string): boolean =>\n matchesCurrency(allowanceCharge.amount, expected) && optionalMatchesCurrency(allowanceCharge.baseAmount, expected);\n\nfunction evaluatePeppolEn16931R051(document: PeppolDocument): boolean {\n const currency = document.documentCurrencyCode;\n\n const documentAllowancesOk = (document.allowanceCharges ?? []).every(allowanceCharge => allowanceChargeMatchesCurrency(allowanceCharge, currency));\n\n const linesOk = getLines(document).every(\n line =>\n matchesCurrency(line.price.priceAmount, currency) &&\n matchesCurrency(line.lineExtensionAmount, currency) &&\n (line.allowanceCharges ?? []).every(allowanceCharge => allowanceChargeMatchesCurrency(allowanceCharge, currency))\n );\n\n const taxTotalsOk = document.taxTotals.every(total => {\n // Only tax totals with subtotals are in scope for BT-110; the accounting currency total (BT-111) is excluded.\n if ((total.taxSubtotals?.length ?? 0) === 0) {\n return true;\n }\n return (\n matchesCurrency(total.taxAmount, currency) &&\n (total.taxSubtotals ?? []).every(subtotal => matchesCurrency(subtotal.taxAmount, currency) && matchesCurrency(subtotal.taxableAmount, currency))\n );\n });\n\n const totals = document.legalMonetaryTotal;\n const requiredTotals: Array<CurrencyAmount> = [\n totals.lineExtensionAmount,\n totals.taxExclusiveAmount,\n totals.taxInclusiveAmount,\n totals.payableAmount,\n ];\n const optionalTotals: Array<CurrencyAmount | undefined> = [\n totals.allowanceTotalAmount,\n totals.chargeTotalAmount,\n totals.prepaidAmount,\n totals.payableRoundingAmount,\n ];\n\n const totalsOk =\n requiredTotals.every(amount => matchesCurrency(amount, currency)) && optionalTotals.every(amount => optionalMatchesCurrency(amount, currency));\n\n return documentAllowancesOk && linesOk && taxTotalsOk && totalsOk;\n}\n\nexport const validatePeppolEn16931R051 = schematronRule(rule, evaluatePeppolEn16931R051);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R053',\n level: 'fatal',\n message: 'Only one tax total with tax subtotals MUST be provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R053(document: PeppolDocument): boolean {\n const withSubtotals = document.taxTotals.filter(total => (total.taxSubtotals?.length ?? 0) > 0);\n return withSubtotals.length === 1;\n}\n\nexport const validatePeppolEn16931R053 = schematronRule(rule, evaluatePeppolEn16931R053);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R054',\n level: 'fatal',\n message: 'Only one tax total without tax subtotals MUST be provided when tax currency code is provided.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R054(document: PeppolDocument): boolean {\n const withoutSubtotals = document.taxTotals.filter(total => (total.taxSubtotals?.length ?? 0) === 0);\n const expected = document.taxCurrencyCode ? 1 : 0;\n return withoutSubtotals.length === expected;\n}\n\nexport const validatePeppolEn16931R054 = schematronRule(rule, evaluatePeppolEn16931R054);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R055',\n level: 'fatal',\n message: 'Invoice total VAT amount and Invoice total VAT amount in accounting currency MUST have the same operational sign',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R055(document: PeppolDocument): boolean {\n const taxCurrency = document.taxCurrencyCode;\n if (!taxCurrency) {\n return true;\n }\n const documentCurrencyAmount = document.taxTotals.find(total => total.taxAmount.currencyId === document.documentCurrencyCode)?.taxAmount.value;\n const taxCurrencyAmount = document.taxTotals.find(total => total.taxAmount.currencyId === taxCurrency)?.taxAmount.value;\n if (typeof documentCurrencyAmount !== 'number' || typeof taxCurrencyAmount !== 'number') {\n return false;\n }\n const bothNonPositive = documentCurrencyAmount <= 0 && taxCurrencyAmount <= 0;\n const bothNonNegative = documentCurrencyAmount >= 0 && taxCurrencyAmount >= 0;\n return bothNonPositive || bothNonNegative;\n}\n\nexport const validatePeppolEn16931R055 = schematronRule(rule, evaluatePeppolEn16931R055);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R061',\n level: 'fatal',\n message: 'Mandate reference MUST be provided for direct debit.',\n} as const satisfies SchematronRule;\n\nconst DIRECT_DEBIT_CODES = new Set(['49', '59']);\n\nfunction evaluatePeppolEn16931R061(document: PeppolDocument): boolean {\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (!DIRECT_DEBIT_CODES.has(payment.paymentMeansCode.code)) {\n return true;\n }\n const mandateId = payment.paymentMandate?.id;\n return typeof mandateId === 'string' && mandateId.trim() !== '';\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R061 = schematronRule(rule, evaluatePeppolEn16931R061);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'PEPPOL-EN16931-R100', level: 'fatal', message: 'Only one invoiced object is allowed pr line' } as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R100(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => (line.documentReference?.length ?? 0) <= 1);\n return passed;\n}\n\nexport const validatePeppolEn16931R100 = schematronRule(rule, evaluatePeppolEn16931R100);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R101',\n level: 'fatal',\n message: 'Element Document reference can only be used for Invoice line object',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R101(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const references = line.documentReference ?? [];\n return references.every(ref => ref.documentTypeCode === '130');\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R101 = schematronRule(rule, evaluatePeppolEn16931R101);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R110',\n level: 'fatal',\n message: 'Start date of line period MUST be within invoice period.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R110(document: PeppolDocument): boolean {\n const invoicePeriodStart = document.invoicePeriod?.startDate;\n if (!invoicePeriodStart) {\n return true;\n }\n const passed = getLines(document).every(line => {\n const lineStart = line.invoicePeriod?.startDate;\n return !lineStart || lineStart >= invoicePeriodStart;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R110 = schematronRule(rule, evaluatePeppolEn16931R110);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R111',\n level: 'fatal',\n message: 'End date of line period MUST be within invoice period.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R111(document: PeppolDocument): boolean {\n const invoicePeriodEnd = document.invoicePeriod?.endDate;\n if (!invoicePeriodEnd) {\n return true;\n }\n const passed = getLines(document).every(line => {\n const lineEnd = line.invoicePeriod?.endDate;\n return !lineEnd || lineEnd <= invoicePeriodEnd;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R111 = schematronRule(rule, evaluatePeppolEn16931R111);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLineQuantity, getLines, schematronRule, slack } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R120',\n level: 'fatal',\n message:\n 'Invoice line net amount MUST equal (Invoiced quantity * (Item net price/item price base quantity) + Sum of invoice line charge amount - sum of invoice line allowance amount',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R120(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const lineExtensionAmount = line.lineExtensionAmount.value;\n const quantity = getLineQuantity(line);\n const priceAmount = line.price.priceAmount.value;\n const baseQuantity = line.price.baseQuantity?.value ?? 1;\n const allowancesTotal = (line.allowanceCharges ?? []).filter(ac => !ac.chargeIndicator).reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const chargesTotal = (line.allowanceCharges ?? []).filter(ac => ac.chargeIndicator).reduce((sum, ac) => sum + (ac.amount?.value ?? 0), 0);\n const expected = quantity * (priceAmount / baseQuantity) + chargesTotal - allowancesTotal;\n return slack(expected, lineExtensionAmount, 0.02);\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R120 = schematronRule(rule, evaluatePeppolEn16931R120);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R121',\n level: 'fatal',\n message: 'Base quantity MUST be a positive number above zero.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R121(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const baseQuantity = line.price.baseQuantity?.value;\n return baseQuantity === undefined || baseQuantity > 0;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R121 = schematronRule(rule, evaluatePeppolEn16931R121);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'PEPPOL-EN16931-R130',\n level: 'fatal',\n message: 'Unit code of price base quantity MUST be same as invoiced quantity.',\n} as const satisfies SchematronRule;\n\nfunction evaluatePeppolEn16931R130(document: PeppolDocument): boolean {\n const passed = getLines(document).every(line => {\n const baseQuantity = line.price.baseQuantity;\n if (!baseQuantity?.unitCode) {\n return true;\n }\n const quantity = 'invoicedQuantity' in line ? line.invoicedQuantity : 'creditedQuantity' in line ? line.creditedQuantity : undefined;\n if (!quantity) {\n return true;\n }\n return baseQuantity.unitCode === quantity.unitCode;\n });\n return passed;\n}\n\nexport const validatePeppolEn16931R130 = schematronRule(rule, evaluatePeppolEn16931R130);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-001',\n level: 'fatal',\n message: 'For Swedish suppliers, Swedish VAT-numbers must consist of 14 characters.',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR001(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'VAT')?.companyId;\n return vatCompanyId?.trim().length === 14;\n}\n\nexport const validateSeR001 = schematronRule(rule, evaluateSeR001);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-002',\n level: 'fatal',\n message: 'For Swedish suppliers, the Swedish VAT-numbers must have the trailing 12 characters in numeric form',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR002(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const vatCompanyId = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id === 'VAT')?.companyId;\n return vatCompanyId !== undefined && /^\\d{12}$/.test(vatCompanyId.slice(2));\n}\n\nexport const validateSeR002 = schematronRule(rule, evaluateSeR002);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'SE-R-003', level: 'fatal', message: 'Swedish organisation numbers should be numeric.' } as const satisfies SchematronRule;\n\nfunction evaluateSeR003(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return companyId === undefined || /^\\d+$/.test(companyId.id);\n}\n\nexport const validateSeR003 = schematronRule(rule, evaluateSeR003);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = { id: 'SE-R-004', level: 'fatal', message: 'Swedish organisation numbers consist of 10 characters.' } as const satisfies SchematronRule;\n\nfunction evaluateSeR004(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return companyId === undefined || companyId.id.trim().length === 10;\n}\n\nexport const validateSeR004 = schematronRule(rule, evaluateSeR004);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-005',\n level: 'fatal',\n message: \"For Swedish suppliers, when using Seller tax registration identifier, 'Godkänd för F-skatt' must be stated\",\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR005(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const nonVatScheme = document.accountingSupplierParty.partyTaxSchemes?.find(scheme => scheme.taxSchemeId.id.toUpperCase() !== 'VAT');\n if (!nonVatScheme) {\n return true;\n }\n return nonVatScheme.companyId.trim().toUpperCase() === 'GODKÄND FÖR F-SKATT';\n}\n\nexport const validateSeR005 = schematronRule(rule, evaluateSeR005);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getLines, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-006',\n level: 'fatal',\n message: 'For Swedish suppliers, only standard VAT rate of 6, 12 or 25 are used',\n} as const satisfies SchematronRule;\n\nconst ALLOWED_RATES = new Set([6, 12, 25]);\n\nfunction evaluateSeR006(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = getLines(document).every(line => {\n const percent = line.item.classifiedTaxCategory.percent;\n return percent === undefined || ALLOWED_RATES.has(percent);\n });\n return passed;\n}\n\nexport const validateSeR006 = schematronRule(rule, evaluateSeR006);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-007',\n level: 'warning',\n message: 'For Swedish suppliers using Plusgiro, the Account ID must be numeric ',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR007(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:PLUSGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && /^\\d+$/.test(accountId.trim());\n });\n return passed;\n}\n\nexport const validateSeR007 = schematronRule(rule, evaluateSeR007);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-008',\n level: 'warning',\n message: 'For Swedish suppliers using Bankgiro, the Account ID must be numeric ',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR008(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:BANKGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && /^\\d+$/.test(accountId.trim());\n });\n return passed;\n}\n\nexport const validateSeR008 = schematronRule(rule, evaluateSeR008);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-009',\n level: 'warning',\n message: 'For Swedish suppliers using Bankgiro, the Account ID must have 7-8 characters',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR009(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:BANKGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && (accountId.trim().length === 7 || accountId.trim().length === 8);\n });\n return passed;\n}\n\nexport const validateSeR009 = schematronRule(rule, evaluateSeR009);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-010',\n level: 'warning',\n message: 'For Swedish suppliers using Plusgiro, the Account ID must have 2-8 characters',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR010(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n if (payment.paymentMeansCode.code !== '30' || payment.payeeFinancialAccount?.financialInstitutionBranch?.id !== 'SE:PLUSGIRO') {\n return true;\n }\n const accountId = payment.payeeFinancialAccount?.id;\n return accountId !== undefined && accountId.trim().length >= 2 && accountId.trim().length <= 8;\n });\n return passed;\n}\n\nexport const validateSeR010 = schematronRule(rule, evaluateSeR010);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-011',\n level: 'warning',\n message:\n 'For Swedish suppliers using Swedish Bankgiro or Plusgiro, the proper way to indicate this is to use Code 30 for PaymentMeans and FinancialInstitutionBranch ID with code SE:BANKGIRO or SE:PLUSGIRO',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR011(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => {\n const code = payment.paymentMeansCode.code;\n return code !== '50' && code !== '56';\n });\n return passed;\n}\n\nexport const validateSeR011 = schematronRule(rule, evaluateSeR011);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { getCustomerCountry, getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-012',\n level: 'warning',\n message: 'For domestic transactions between Swedish trading partners, credit transfer should be indicated by PaymentMeansCode=\"30\"',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR012(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE' || getCustomerCountry(document) !== 'SE') {\n return true;\n }\n const passed = (document.paymentMeans ?? []).every(payment => payment.paymentMeansCode.code !== '31');\n return passed;\n}\n\nexport const validateSeR012 = schematronRule(rule, evaluateSeR012);\n","import type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\nimport type { SchematronRule } from '#/schematron/helpers.ts';\n\nimport { checkSEOrgnr } from '#/peppol-validations/check-se-orgnr.ts';\nimport { getSupplierCountry, schematronRule } from '#/schematron/helpers.ts';\n\nconst rule = {\n id: 'SE-R-013',\n level: 'fatal',\n message: 'The last digit of a Swedish organization number must be valid according to the Luhn algorithm.',\n} as const satisfies SchematronRule;\n\nfunction evaluateSeR013(document: PeppolDocument): boolean {\n if (getSupplierCountry(document) !== 'SE') {\n return true;\n }\n const companyId = document.accountingSupplierParty.partyLegalEntity.companyId;\n return companyId === undefined || checkSEOrgnr(companyId.id);\n}\n\nexport const validateSeR013 = schematronRule(rule, evaluateSeR013);\n","import type { SchematronDocumentValidator } from '#/schematron/helpers.ts';\n\nimport { validateCenEn16931BrAe01 } from '#/schematron/cen/ae/cen-en16931-br-ae-01.ts';\nimport { validateCenEn16931BrAe02 } from '#/schematron/cen/ae/cen-en16931-br-ae-02.ts';\nimport { validateCenEn16931BrAe03 } from '#/schematron/cen/ae/cen-en16931-br-ae-03.ts';\nimport { validateCenEn16931BrAe04 } from '#/schematron/cen/ae/cen-en16931-br-ae-04.ts';\nimport { validateCenEn16931BrAe05 } from '#/schematron/cen/ae/cen-en16931-br-ae-05.ts';\nimport { validateCenEn16931BrAe06 } from '#/schematron/cen/ae/cen-en16931-br-ae-06.ts';\nimport { validateCenEn16931BrAe07 } from '#/schematron/cen/ae/cen-en16931-br-ae-07.ts';\nimport { validateCenEn16931BrAe08 } from '#/schematron/cen/ae/cen-en16931-br-ae-08.ts';\nimport { validateCenEn16931BrAe09 } from '#/schematron/cen/ae/cen-en16931-br-ae-09.ts';\nimport { validateCenEn16931BrAe10 } from '#/schematron/cen/ae/cen-en16931-br-ae-10.ts';\nimport { validateCenEn16931BrAf01 } from '#/schematron/cen/af/cen-en16931-br-af-01.ts';\nimport { validateCenEn16931BrAf02 } from '#/schematron/cen/af/cen-en16931-br-af-02.ts';\nimport { validateCenEn16931BrAf03 } from '#/schematron/cen/af/cen-en16931-br-af-03.ts';\nimport { validateCenEn16931BrAf04 } from '#/schematron/cen/af/cen-en16931-br-af-04.ts';\nimport { validateCenEn16931BrAf05 } from '#/schematron/cen/af/cen-en16931-br-af-05.ts';\nimport { validateCenEn16931BrAf06 } from '#/schematron/cen/af/cen-en16931-br-af-06.ts';\nimport { validateCenEn16931BrAf07 } from '#/schematron/cen/af/cen-en16931-br-af-07.ts';\nimport { validateCenEn16931BrAf08 } from '#/schematron/cen/af/cen-en16931-br-af-08.ts';\nimport { validateCenEn16931BrAf09 } from '#/schematron/cen/af/cen-en16931-br-af-09.ts';\nimport { validateCenEn16931BrAf10 } from '#/schematron/cen/af/cen-en16931-br-af-10.ts';\nimport { validateCenEn16931BrAg01 } from '#/schematron/cen/ag/cen-en16931-br-ag-01.ts';\nimport { validateCenEn16931BrAg02 } from '#/schematron/cen/ag/cen-en16931-br-ag-02.ts';\nimport { validateCenEn16931BrAg03 } from '#/schematron/cen/ag/cen-en16931-br-ag-03.ts';\nimport { validateCenEn16931BrAg04 } from '#/schematron/cen/ag/cen-en16931-br-ag-04.ts';\nimport { validateCenEn16931BrAg05 } from '#/schematron/cen/ag/cen-en16931-br-ag-05.ts';\nimport { validateCenEn16931BrAg06 } from '#/schematron/cen/ag/cen-en16931-br-ag-06.ts';\nimport { validateCenEn16931BrAg07 } from '#/schematron/cen/ag/cen-en16931-br-ag-07.ts';\nimport { validateCenEn16931BrAg08 } from '#/schematron/cen/ag/cen-en16931-br-ag-08.ts';\nimport { validateCenEn16931BrAg09 } from '#/schematron/cen/ag/cen-en16931-br-ag-09.ts';\nimport { validateCenEn16931BrAg10 } from '#/schematron/cen/ag/cen-en16931-br-ag-10.ts';\nimport { validateCenEn16931BrB01 } from '#/schematron/cen/b/cen-en16931-br-b-01.ts';\nimport { validateCenEn16931BrB02 } from '#/schematron/cen/b/cen-en16931-br-b-02.ts';\nimport { validateCenEn16931Br01 } from '#/schematron/cen/cen-en16931-br-01.ts';\nimport { validateCenEn16931Br02 } from '#/schematron/cen/cen-en16931-br-02.ts';\nimport { validateCenEn16931Br03 } from '#/schematron/cen/cen-en16931-br-03.ts';\nimport { validateCenEn16931Br04 } from '#/schematron/cen/cen-en16931-br-04.ts';\nimport { validateCenEn16931Br05 } from '#/schematron/cen/cen-en16931-br-05.ts';\nimport { validateCenEn16931Br06 } from '#/schematron/cen/cen-en16931-br-06.ts';\nimport { validateCenEn16931Br07 } from '#/schematron/cen/cen-en16931-br-07.ts';\nimport { validateCenEn16931Br08 } from '#/schematron/cen/cen-en16931-br-08.ts';\nimport { validateCenEn16931Br09 } from '#/schematron/cen/cen-en16931-br-09.ts';\nimport { validateCenEn16931Br10 } from '#/schematron/cen/cen-en16931-br-10.ts';\nimport { validateCenEn16931Br11 } from '#/schematron/cen/cen-en16931-br-11.ts';\nimport { validateCenEn16931Br12 } from '#/schematron/cen/cen-en16931-br-12.ts';\nimport { validateCenEn16931Br13 } from '#/schematron/cen/cen-en16931-br-13.ts';\nimport { validateCenEn16931Br14 } from '#/schematron/cen/cen-en16931-br-14.ts';\nimport { validateCenEn16931Br15 } from '#/schematron/cen/cen-en16931-br-15.ts';\nimport { validateCenEn16931Br16 } from '#/schematron/cen/cen-en16931-br-16.ts';\nimport { validateCenEn16931Br17 } from '#/schematron/cen/cen-en16931-br-17.ts';\nimport { validateCenEn16931Br18 } from '#/schematron/cen/cen-en16931-br-18.ts';\nimport { validateCenEn16931Br19 } from '#/schematron/cen/cen-en16931-br-19.ts';\nimport { validateCenEn16931Br20 } from '#/schematron/cen/cen-en16931-br-20.ts';\nimport { validateCenEn16931Br21 } from '#/schematron/cen/cen-en16931-br-21.ts';\nimport { validateCenEn16931Br22 } from '#/schematron/cen/cen-en16931-br-22.ts';\nimport { validateCenEn16931Br23 } from '#/schematron/cen/cen-en16931-br-23.ts';\nimport { validateCenEn16931Br24 } from '#/schematron/cen/cen-en16931-br-24.ts';\nimport { validateCenEn16931Br25 } from '#/schematron/cen/cen-en16931-br-25.ts';\nimport { validateCenEn16931Br26 } from '#/schematron/cen/cen-en16931-br-26.ts';\nimport { validateCenEn16931Br27 } from '#/schematron/cen/cen-en16931-br-27.ts';\nimport { validateCenEn16931Br28 } from '#/schematron/cen/cen-en16931-br-28.ts';\nimport { validateCenEn16931Br29 } from '#/schematron/cen/cen-en16931-br-29.ts';\nimport { validateCenEn16931Br30 } from '#/schematron/cen/cen-en16931-br-30.ts';\nimport { validateCenEn16931Br31 } from '#/schematron/cen/cen-en16931-br-31.ts';\nimport { validateCenEn16931Br32 } from '#/schematron/cen/cen-en16931-br-32.ts';\nimport { validateCenEn16931Br33 } from '#/schematron/cen/cen-en16931-br-33.ts';\nimport { validateCenEn16931Br36 } from '#/schematron/cen/cen-en16931-br-36.ts';\nimport { validateCenEn16931Br37 } from '#/schematron/cen/cen-en16931-br-37.ts';\nimport { validateCenEn16931Br38 } from '#/schematron/cen/cen-en16931-br-38.ts';\nimport { validateCenEn16931Br41 } from '#/schematron/cen/cen-en16931-br-41.ts';\nimport { validateCenEn16931Br42 } from '#/schematron/cen/cen-en16931-br-42.ts';\nimport { validateCenEn16931Br43 } from '#/schematron/cen/cen-en16931-br-43.ts';\nimport { validateCenEn16931Br44 } from '#/schematron/cen/cen-en16931-br-44.ts';\nimport { validateCenEn16931Br45 } from '#/schematron/cen/cen-en16931-br-45.ts';\nimport { validateCenEn16931Br46 } from '#/schematron/cen/cen-en16931-br-46.ts';\nimport { validateCenEn16931Br47 } from '#/schematron/cen/cen-en16931-br-47.ts';\nimport { validateCenEn16931Br48 } from '#/schematron/cen/cen-en16931-br-48.ts';\nimport { validateCenEn16931Br49 } from '#/schematron/cen/cen-en16931-br-49.ts';\nimport { validateCenEn16931Br50 } from '#/schematron/cen/cen-en16931-br-50.ts';\nimport { validateCenEn16931Br51 } from '#/schematron/cen/cen-en16931-br-51.ts';\nimport { validateCenEn16931Br52 } from '#/schematron/cen/cen-en16931-br-52.ts';\nimport { validateCenEn16931Br53 } from '#/schematron/cen/cen-en16931-br-53.ts';\nimport { validateCenEn16931Br54 } from '#/schematron/cen/cen-en16931-br-54.ts';\nimport { validateCenEn16931Br55 } from '#/schematron/cen/cen-en16931-br-55.ts';\nimport { validateCenEn16931Br56 } from '#/schematron/cen/cen-en16931-br-56.ts';\nimport { validateCenEn16931Br57 } from '#/schematron/cen/cen-en16931-br-57.ts';\nimport { validateCenEn16931Br61 } from '#/schematron/cen/cen-en16931-br-61.ts';\nimport { validateCenEn16931Br62 } from '#/schematron/cen/cen-en16931-br-62.ts';\nimport { validateCenEn16931Br63 } from '#/schematron/cen/cen-en16931-br-63.ts';\nimport { validateCenEn16931Br64 } from '#/schematron/cen/cen-en16931-br-64.ts';\nimport { validateCenEn16931Br65 } from '#/schematron/cen/cen-en16931-br-65.ts';\nimport { validateCenEn16931BrCl08 } from '#/schematron/cen/cl/cen-en16931-br-cl-08.ts';\nimport { validateCenEn16931BrCo03 } from '#/schematron/cen/co/cen-en16931-br-co-03.ts';\nimport { validateCenEn16931BrCo04 } from '#/schematron/cen/co/cen-en16931-br-co-04.ts';\nimport { validateCenEn16931BrCo05 } from '#/schematron/cen/co/cen-en16931-br-co-05.ts';\nimport { validateCenEn16931BrCo06 } from '#/schematron/cen/co/cen-en16931-br-co-06.ts';\nimport { validateCenEn16931BrCo07 } from '#/schematron/cen/co/cen-en16931-br-co-07.ts';\nimport { validateCenEn16931BrCo08 } from '#/schematron/cen/co/cen-en16931-br-co-08.ts';\nimport { validateCenEn16931BrCo09 } from '#/schematron/cen/co/cen-en16931-br-co-09.ts';\nimport { validateCenEn16931BrCo10 } from '#/schematron/cen/co/cen-en16931-br-co-10.ts';\nimport { validateCenEn16931BrCo11 } from '#/schematron/cen/co/cen-en16931-br-co-11.ts';\nimport { validateCenEn16931BrCo12 } from '#/schematron/cen/co/cen-en16931-br-co-12.ts';\nimport { validateCenEn16931BrCo13 } from '#/schematron/cen/co/cen-en16931-br-co-13.ts';\nimport { validateCenEn16931BrCo14 } from '#/schematron/cen/co/cen-en16931-br-co-14.ts';\nimport { validateCenEn16931BrCo15 } from '#/schematron/cen/co/cen-en16931-br-co-15.ts';\nimport { validateCenEn16931BrCo16 } from '#/schematron/cen/co/cen-en16931-br-co-16.ts';\nimport { validateCenEn16931BrCo17 } from '#/schematron/cen/co/cen-en16931-br-co-17.ts';\nimport { validateCenEn16931BrCo18 } from '#/schematron/cen/co/cen-en16931-br-co-18.ts';\nimport { validateCenEn16931BrCo19 } from '#/schematron/cen/co/cen-en16931-br-co-19.ts';\nimport { validateCenEn16931BrCo20 } from '#/schematron/cen/co/cen-en16931-br-co-20.ts';\nimport { validateCenEn16931BrCo21 } from '#/schematron/cen/co/cen-en16931-br-co-21.ts';\nimport { validateCenEn16931BrCo22 } from '#/schematron/cen/co/cen-en16931-br-co-22.ts';\nimport { validateCenEn16931BrCo23 } from '#/schematron/cen/co/cen-en16931-br-co-23.ts';\nimport { validateCenEn16931BrCo24 } from '#/schematron/cen/co/cen-en16931-br-co-24.ts';\nimport { validateCenEn16931BrCo25 } from '#/schematron/cen/co/cen-en16931-br-co-25.ts';\nimport { validateCenEn16931BrCo26 } from '#/schematron/cen/co/cen-en16931-br-co-26.ts';\nimport { validateCenEn16931BrDec01 } from '#/schematron/cen/dec/cen-en16931-br-dec-01.ts';\nimport { validateCenEn16931BrDec02 } from '#/schematron/cen/dec/cen-en16931-br-dec-02.ts';\nimport { validateCenEn16931BrDec05 } from '#/schematron/cen/dec/cen-en16931-br-dec-05.ts';\nimport { validateCenEn16931BrDec06 } from '#/schematron/cen/dec/cen-en16931-br-dec-06.ts';\nimport { validateCenEn16931BrDec09 } from '#/schematron/cen/dec/cen-en16931-br-dec-09.ts';\nimport { validateCenEn16931BrDec10 } from '#/schematron/cen/dec/cen-en16931-br-dec-10.ts';\nimport { validateCenEn16931BrDec11 } from '#/schematron/cen/dec/cen-en16931-br-dec-11.ts';\nimport { validateCenEn16931BrDec12 } from '#/schematron/cen/dec/cen-en16931-br-dec-12.ts';\nimport { validateCenEn16931BrDec13 } from '#/schematron/cen/dec/cen-en16931-br-dec-13.ts';\nimport { validateCenEn16931BrDec14 } from '#/schematron/cen/dec/cen-en16931-br-dec-14.ts';\nimport { validateCenEn16931BrDec15 } from '#/schematron/cen/dec/cen-en16931-br-dec-15.ts';\nimport { validateCenEn16931BrDec16 } from '#/schematron/cen/dec/cen-en16931-br-dec-16.ts';\nimport { validateCenEn16931BrDec17 } from '#/schematron/cen/dec/cen-en16931-br-dec-17.ts';\nimport { validateCenEn16931BrDec18 } from '#/schematron/cen/dec/cen-en16931-br-dec-18.ts';\nimport { validateCenEn16931BrDec19 } from '#/schematron/cen/dec/cen-en16931-br-dec-19.ts';\nimport { validateCenEn16931BrDec20 } from '#/schematron/cen/dec/cen-en16931-br-dec-20.ts';\nimport { validateCenEn16931BrDec23 } from '#/schematron/cen/dec/cen-en16931-br-dec-23.ts';\nimport { validateCenEn16931BrDec24 } from '#/schematron/cen/dec/cen-en16931-br-dec-24.ts';\nimport { validateCenEn16931BrDec25 } from '#/schematron/cen/dec/cen-en16931-br-dec-25.ts';\nimport { validateCenEn16931BrDec27 } from '#/schematron/cen/dec/cen-en16931-br-dec-27.ts';\nimport { validateCenEn16931BrDec28 } from '#/schematron/cen/dec/cen-en16931-br-dec-28.ts';\nimport { validateCenEn16931BrE01 } from '#/schematron/cen/e/cen-en16931-br-e-01.ts';\nimport { validateCenEn16931BrE02 } from '#/schematron/cen/e/cen-en16931-br-e-02.ts';\nimport { validateCenEn16931BrE03 } from '#/schematron/cen/e/cen-en16931-br-e-03.ts';\nimport { validateCenEn16931BrE04 } from '#/schematron/cen/e/cen-en16931-br-e-04.ts';\nimport { validateCenEn16931BrE05 } from '#/schematron/cen/e/cen-en16931-br-e-05.ts';\nimport { validateCenEn16931BrE06 } from '#/schematron/cen/e/cen-en16931-br-e-06.ts';\nimport { validateCenEn16931BrE07 } from '#/schematron/cen/e/cen-en16931-br-e-07.ts';\nimport { validateCenEn16931BrE08 } from '#/schematron/cen/e/cen-en16931-br-e-08.ts';\nimport { validateCenEn16931BrE09 } from '#/schematron/cen/e/cen-en16931-br-e-09.ts';\nimport { validateCenEn16931BrE10 } from '#/schematron/cen/e/cen-en16931-br-e-10.ts';\nimport { validateCenEn16931BrG01 } from '#/schematron/cen/g/cen-en16931-br-g-01.ts';\nimport { validateCenEn16931BrG02 } from '#/schematron/cen/g/cen-en16931-br-g-02.ts';\nimport { validateCenEn16931BrG03 } from '#/schematron/cen/g/cen-en16931-br-g-03.ts';\nimport { validateCenEn16931BrG04 } from '#/schematron/cen/g/cen-en16931-br-g-04.ts';\nimport { validateCenEn16931BrG05 } from '#/schematron/cen/g/cen-en16931-br-g-05.ts';\nimport { validateCenEn16931BrG06 } from '#/schematron/cen/g/cen-en16931-br-g-06.ts';\nimport { validateCenEn16931BrG07 } from '#/schematron/cen/g/cen-en16931-br-g-07.ts';\nimport { validateCenEn16931BrG08 } from '#/schematron/cen/g/cen-en16931-br-g-08.ts';\nimport { validateCenEn16931BrG09 } from '#/schematron/cen/g/cen-en16931-br-g-09.ts';\nimport { validateCenEn16931BrG10 } from '#/schematron/cen/g/cen-en16931-br-g-10.ts';\nimport { validateCenEn16931BrIc01 } from '#/schematron/cen/ic/cen-en16931-br-ic-01.ts';\nimport { validateCenEn16931BrIc02 } from '#/schematron/cen/ic/cen-en16931-br-ic-02.ts';\nimport { validateCenEn16931BrIc03 } from '#/schematron/cen/ic/cen-en16931-br-ic-03.ts';\nimport { validateCenEn16931BrIc04 } from '#/schematron/cen/ic/cen-en16931-br-ic-04.ts';\nimport { validateCenEn16931BrIc05 } from '#/schematron/cen/ic/cen-en16931-br-ic-05.ts';\nimport { validateCenEn16931BrIc06 } from '#/schematron/cen/ic/cen-en16931-br-ic-06.ts';\nimport { validateCenEn16931BrIc07 } from '#/schematron/cen/ic/cen-en16931-br-ic-07.ts';\nimport { validateCenEn16931BrIc08 } from '#/schematron/cen/ic/cen-en16931-br-ic-08.ts';\nimport { validateCenEn16931BrIc09 } from '#/schematron/cen/ic/cen-en16931-br-ic-09.ts';\nimport { validateCenEn16931BrIc10 } from '#/schematron/cen/ic/cen-en16931-br-ic-10.ts';\nimport { validateCenEn16931BrIc11 } from '#/schematron/cen/ic/cen-en16931-br-ic-11.ts';\nimport { validateCenEn16931BrIc12 } from '#/schematron/cen/ic/cen-en16931-br-ic-12.ts';\nimport { validateCenEn16931BrO01 } from '#/schematron/cen/o/cen-en16931-br-o-01.ts';\nimport { validateCenEn16931BrO02 } from '#/schematron/cen/o/cen-en16931-br-o-02.ts';\nimport { validateCenEn16931BrO03 } from '#/schematron/cen/o/cen-en16931-br-o-03.ts';\nimport { validateCenEn16931BrO04 } from '#/schematron/cen/o/cen-en16931-br-o-04.ts';\nimport { validateCenEn16931BrO05 } from '#/schematron/cen/o/cen-en16931-br-o-05.ts';\nimport { validateCenEn16931BrO06 } from '#/schematron/cen/o/cen-en16931-br-o-06.ts';\nimport { validateCenEn16931BrO07 } from '#/schematron/cen/o/cen-en16931-br-o-07.ts';\nimport { validateCenEn16931BrO08 } from '#/schematron/cen/o/cen-en16931-br-o-08.ts';\nimport { validateCenEn16931BrO09 } from '#/schematron/cen/o/cen-en16931-br-o-09.ts';\nimport { validateCenEn16931BrO10 } from '#/schematron/cen/o/cen-en16931-br-o-10.ts';\nimport { validateCenEn16931BrO11 } from '#/schematron/cen/o/cen-en16931-br-o-11.ts';\nimport { validateCenEn16931BrO12 } from '#/schematron/cen/o/cen-en16931-br-o-12.ts';\nimport { validateCenEn16931BrO13 } from '#/schematron/cen/o/cen-en16931-br-o-13.ts';\nimport { validateCenEn16931BrO14 } from '#/schematron/cen/o/cen-en16931-br-o-14.ts';\nimport { validateCenEn16931BrS01 } from '#/schematron/cen/s/cen-en16931-br-s-01.ts';\nimport { validateCenEn16931BrS02 } from '#/schematron/cen/s/cen-en16931-br-s-02.ts';\nimport { validateCenEn16931BrS03 } from '#/schematron/cen/s/cen-en16931-br-s-03.ts';\nimport { validateCenEn16931BrS04 } from '#/schematron/cen/s/cen-en16931-br-s-04.ts';\nimport { validateCenEn16931BrS05 } from '#/schematron/cen/s/cen-en16931-br-s-05.ts';\nimport { validateCenEn16931BrS06 } from '#/schematron/cen/s/cen-en16931-br-s-06.ts';\nimport { validateCenEn16931BrS07 } from '#/schematron/cen/s/cen-en16931-br-s-07.ts';\nimport { validateCenEn16931BrS08 } from '#/schematron/cen/s/cen-en16931-br-s-08.ts';\nimport { validateCenEn16931BrS09 } from '#/schematron/cen/s/cen-en16931-br-s-09.ts';\nimport { validateCenEn16931BrS10 } from '#/schematron/cen/s/cen-en16931-br-s-10.ts';\nimport { validateCenEn16931BrZ01 } from '#/schematron/cen/z/cen-en16931-br-z-01.ts';\nimport { validateCenEn16931BrZ02 } from '#/schematron/cen/z/cen-en16931-br-z-02.ts';\nimport { validateCenEn16931BrZ03 } from '#/schematron/cen/z/cen-en16931-br-z-03.ts';\nimport { validateCenEn16931BrZ04 } from '#/schematron/cen/z/cen-en16931-br-z-04.ts';\nimport { validateCenEn16931BrZ05 } from '#/schematron/cen/z/cen-en16931-br-z-05.ts';\nimport { validateCenEn16931BrZ06 } from '#/schematron/cen/z/cen-en16931-br-z-06.ts';\nimport { validateCenEn16931BrZ07 } from '#/schematron/cen/z/cen-en16931-br-z-07.ts';\nimport { validateCenEn16931BrZ08 } from '#/schematron/cen/z/cen-en16931-br-z-08.ts';\nimport { validateCenEn16931BrZ09 } from '#/schematron/cen/z/cen-en16931-br-z-09.ts';\nimport { validateCenEn16931BrZ10 } from '#/schematron/cen/z/cen-en16931-br-z-10.ts';\nimport { validateDeR001 } from '#/schematron/de/de-r-001.ts';\nimport { validateDeR002 } from '#/schematron/de/de-r-002.ts';\nimport { validateDeR003 } from '#/schematron/de/de-r-003.ts';\nimport { validateDeR004 } from '#/schematron/de/de-r-004.ts';\nimport { validateDeR005 } from '#/schematron/de/de-r-005.ts';\nimport { validateDeR006 } from '#/schematron/de/de-r-006.ts';\nimport { validateDeR007 } from '#/schematron/de/de-r-007.ts';\nimport { validateDeR008 } from '#/schematron/de/de-r-008.ts';\nimport { validateDeR009 } from '#/schematron/de/de-r-009.ts';\nimport { validateDeR010 } from '#/schematron/de/de-r-010.ts';\nimport { validateDeR011 } from '#/schematron/de/de-r-011.ts';\nimport { validateDeR014 } from '#/schematron/de/de-r-014.ts';\nimport { validateDeR015 } from '#/schematron/de/de-r-015.ts';\nimport { validateDeR016 } from '#/schematron/de/de-r-016.ts';\nimport { validateDeR017 } from '#/schematron/de/de-r-017.ts';\nimport { validateDeR018 } from '#/schematron/de/de-r-018.ts';\nimport { validateDeR019 } from '#/schematron/de/de-r-019.ts';\nimport { validateDeR020 } from '#/schematron/de/de-r-020.ts';\nimport { validateDeR022 } from '#/schematron/de/de-r-022.ts';\nimport { validateDeR023_1 } from '#/schematron/de/de-r-023-1.ts';\nimport { validateDeR023_2 } from '#/schematron/de/de-r-023-2.ts';\nimport { validateDeR024_1 } from '#/schematron/de/de-r-024-1.ts';\nimport { validateDeR024_2 } from '#/schematron/de/de-r-024-2.ts';\nimport { validateDeR025_1 } from '#/schematron/de/de-r-025-1.ts';\nimport { validateDeR025_2 } from '#/schematron/de/de-r-025-2.ts';\nimport { validateDeR026 } from '#/schematron/de/de-r-026.ts';\nimport { validateDeR027 } from '#/schematron/de/de-r-027.ts';\nimport { validateDeR028 } from '#/schematron/de/de-r-028.ts';\nimport { validateDeR030 } from '#/schematron/de/de-r-030.ts';\nimport { validateDeR031 } from '#/schematron/de/de-r-031.ts';\nimport { validateDkR002 } from '#/schematron/dk/dk-r-002.ts';\nimport { validateDkR003 } from '#/schematron/dk/dk-r-003.ts';\nimport { validateDkR004 } from '#/schematron/dk/dk-r-004.ts';\nimport { validateDkR005 } from '#/schematron/dk/dk-r-005.ts';\nimport { validateDkR006 } from '#/schematron/dk/dk-r-006.ts';\nimport { validateDkR007 } from '#/schematron/dk/dk-r-007.ts';\nimport { validateDkR008 } from '#/schematron/dk/dk-r-008.ts';\nimport { validateDkR009 } from '#/schematron/dk/dk-r-009.ts';\nimport { validateDkR010 } from '#/schematron/dk/dk-r-010.ts';\nimport { validateDkR011 } from '#/schematron/dk/dk-r-011.ts';\nimport { validateDkR013 } from '#/schematron/dk/dk-r-013.ts';\nimport { validateDkR014 } from '#/schematron/dk/dk-r-014.ts';\nimport { validateDkR016 } from '#/schematron/dk/dk-r-016.ts';\nimport { validateDkR017 } from '#/schematron/dk/dk-r-017.ts';\nimport { validateGrR001_1 } from '#/schematron/gr/gr-r-001-1.ts';\nimport { validateGrR001_2 } from '#/schematron/gr/gr-r-001-2.ts';\nimport { validateGrR001_3 } from '#/schematron/gr/gr-r-001-3.ts';\nimport { validateGrR001_4 } from '#/schematron/gr/gr-r-001-4.ts';\nimport { validateGrR001_5 } from '#/schematron/gr/gr-r-001-5.ts';\nimport { validateGrR001_6 } from '#/schematron/gr/gr-r-001-6.ts';\nimport { validateGrR001_7 } from '#/schematron/gr/gr-r-001-7.ts';\nimport { validateGrR002 } from '#/schematron/gr/gr-r-002.ts';\nimport { validateGrR003 } from '#/schematron/gr/gr-r-003.ts';\nimport { validateGrR004_1 } from '#/schematron/gr/gr-r-004-1.ts';\nimport { validateGrR004_2 } from '#/schematron/gr/gr-r-004-2.ts';\nimport { validateGrR005 } from '#/schematron/gr/gr-r-005.ts';\nimport { validateGrR006 } from '#/schematron/gr/gr-r-006.ts';\nimport { validateGrR008_2 } from '#/schematron/gr/gr-r-008-2.ts';\nimport { validateGrR008_3 } from '#/schematron/gr/gr-r-008-3.ts';\nimport { validateGrR009 } from '#/schematron/gr/gr-r-009.ts';\nimport { validateGrR010 } from '#/schematron/gr/gr-r-010.ts';\nimport { validateGrS008_1 } from '#/schematron/gr/gr-s-008-1.ts';\nimport { validateGrS011 } from '#/schematron/gr/gr-s-011.ts';\nimport { validateIsR001 } from '#/schematron/is/is-r-001.ts';\nimport { validateIsR002 } from '#/schematron/is/is-r-002.ts';\nimport { validateIsR003 } from '#/schematron/is/is-r-003.ts';\nimport { validateIsR004 } from '#/schematron/is/is-r-004.ts';\nimport { validateIsR005 } from '#/schematron/is/is-r-005.ts';\nimport { validateIsR006 } from '#/schematron/is/is-r-006.ts';\nimport { validateIsR007 } from '#/schematron/is/is-r-007.ts';\nimport { validateIsR008 } from '#/schematron/is/is-r-008.ts';\nimport { validateIsR009 } from '#/schematron/is/is-r-009.ts';\nimport { validateIsR010 } from '#/schematron/is/is-r-010.ts';\nimport { validateItR001 } from '#/schematron/it/it-r-001.ts';\nimport { validateItR002 } from '#/schematron/it/it-r-002.ts';\nimport { validateItR003 } from '#/schematron/it/it-r-003.ts';\nimport { validateItR004 } from '#/schematron/it/it-r-004.ts';\nimport { validateNlR001 } from '#/schematron/nl/nl-r-001.ts';\nimport { validateNlR002 } from '#/schematron/nl/nl-r-002.ts';\nimport { validateNlR003 } from '#/schematron/nl/nl-r-003.ts';\nimport { validateNlR004 } from '#/schematron/nl/nl-r-004.ts';\nimport { validateNlR005 } from '#/schematron/nl/nl-r-005.ts';\nimport { validateNlR006 } from '#/schematron/nl/nl-r-006.ts';\nimport { validateNlR007 } from '#/schematron/nl/nl-r-007.ts';\nimport { validateNlR008 } from '#/schematron/nl/nl-r-008.ts';\nimport { validateNlR009 } from '#/schematron/nl/nl-r-009.ts';\nimport { validateNoR001 } from '#/schematron/no/no-r-001.ts';\nimport { validateNoR002 } from '#/schematron/no/no-r-002.ts';\nimport { validatePeppolEn16931CL001 } from '#/schematron/peppol/cl/peppol-en16931-cl001.ts';\nimport { validatePeppolEn16931CL002 } from '#/schematron/peppol/cl/peppol-en16931-cl002.ts';\nimport { validatePeppolEn16931CL003 } from '#/schematron/peppol/cl/peppol-en16931-cl003.ts';\nimport { validatePeppolEn16931CL006 } from '#/schematron/peppol/cl/peppol-en16931-cl006.ts';\nimport { validatePeppolEn16931CL007 } from '#/schematron/peppol/cl/peppol-en16931-cl007.ts';\nimport { validatePeppolEn16931CL008 } from '#/schematron/peppol/cl/peppol-en16931-cl008.ts';\nimport { validatePeppolCommonR040 } from '#/schematron/peppol/common/peppol-common-r040.ts';\nimport { validatePeppolCommonR041 } from '#/schematron/peppol/common/peppol-common-r041.ts';\nimport { validatePeppolCommonR042 } from '#/schematron/peppol/common/peppol-common-r042.ts';\nimport { validatePeppolCommonR043 } from '#/schematron/peppol/common/peppol-common-r043.ts';\nimport { validatePeppolCommonR044 } from '#/schematron/peppol/common/peppol-common-r044.ts';\nimport { validatePeppolCommonR045 } from '#/schematron/peppol/common/peppol-common-r045.ts';\nimport { validatePeppolCommonR046 } from '#/schematron/peppol/common/peppol-common-r046.ts';\nimport { validatePeppolCommonR047 } from '#/schematron/peppol/common/peppol-common-r047.ts';\nimport { validatePeppolCommonR049 } from '#/schematron/peppol/common/peppol-common-r049.ts';\nimport { validatePeppolCommonR050 } from '#/schematron/peppol/common/peppol-common-r050.ts';\nimport { validatePeppolCommonR052 } from '#/schematron/peppol/common/peppol-common-r052.ts';\nimport { validatePeppolCommonR053 } from '#/schematron/peppol/common/peppol-common-r053.ts';\nimport { validatePeppolEn16931F001 } from '#/schematron/peppol/f/peppol-en16931-f001.ts';\nimport { validatePeppolEn16931P0100 } from '#/schematron/peppol/p/peppol-en16931-p0100.ts';\nimport { validatePeppolEn16931P0101 } from '#/schematron/peppol/p/peppol-en16931-p0101.ts';\nimport { validatePeppolEn16931P0104 } from '#/schematron/peppol/p/peppol-en16931-p0104.ts';\nimport { validatePeppolEn16931P0105 } from '#/schematron/peppol/p/peppol-en16931-p0105.ts';\nimport { validatePeppolEn16931P0106 } from '#/schematron/peppol/p/peppol-en16931-p0106.ts';\nimport { validatePeppolEn16931P0107 } from '#/schematron/peppol/p/peppol-en16931-p0107.ts';\nimport { validatePeppolEn16931P0108 } from '#/schematron/peppol/p/peppol-en16931-p0108.ts';\nimport { validatePeppolEn16931P0109 } from '#/schematron/peppol/p/peppol-en16931-p0109.ts';\nimport { validatePeppolEn16931P0110 } from '#/schematron/peppol/p/peppol-en16931-p0110.ts';\nimport { validatePeppolEn16931P0111 } from '#/schematron/peppol/p/peppol-en16931-p0111.ts';\nimport { validatePeppolEn16931P0112 } from '#/schematron/peppol/p/peppol-en16931-p0112.ts';\nimport { validatePeppolEn16931R001 } from '#/schematron/peppol/r/peppol-en16931-r001.ts';\nimport { validatePeppolEn16931R002 } from '#/schematron/peppol/r/peppol-en16931-r002.ts';\nimport { validatePeppolEn16931R003 } from '#/schematron/peppol/r/peppol-en16931-r003.ts';\nimport { validatePeppolEn16931R004 } from '#/schematron/peppol/r/peppol-en16931-r004.ts';\nimport { validatePeppolEn16931R005 } from '#/schematron/peppol/r/peppol-en16931-r005.ts';\nimport { validatePeppolEn16931R007 } from '#/schematron/peppol/r/peppol-en16931-r007.ts';\nimport { validatePeppolEn16931R008 } from '#/schematron/peppol/r/peppol-en16931-r008.ts';\nimport { validatePeppolEn16931R010 } from '#/schematron/peppol/r/peppol-en16931-r010.ts';\nimport { validatePeppolEn16931R020 } from '#/schematron/peppol/r/peppol-en16931-r020.ts';\nimport { validatePeppolEn16931R040 } from '#/schematron/peppol/r/peppol-en16931-r040.ts';\nimport { validatePeppolEn16931R041 } from '#/schematron/peppol/r/peppol-en16931-r041.ts';\nimport { validatePeppolEn16931R042 } from '#/schematron/peppol/r/peppol-en16931-r042.ts';\nimport { validatePeppolEn16931R043 } from '#/schematron/peppol/r/peppol-en16931-r043.ts';\nimport { validatePeppolEn16931R044 } from '#/schematron/peppol/r/peppol-en16931-r044.ts';\nimport { validatePeppolEn16931R046 } from '#/schematron/peppol/r/peppol-en16931-r046.ts';\nimport { validatePeppolEn16931R051 } from '#/schematron/peppol/r/peppol-en16931-r051.ts';\nimport { validatePeppolEn16931R053 } from '#/schematron/peppol/r/peppol-en16931-r053.ts';\nimport { validatePeppolEn16931R054 } from '#/schematron/peppol/r/peppol-en16931-r054.ts';\nimport { validatePeppolEn16931R055 } from '#/schematron/peppol/r/peppol-en16931-r055.ts';\nimport { validatePeppolEn16931R061 } from '#/schematron/peppol/r/peppol-en16931-r061.ts';\nimport { validatePeppolEn16931R100 } from '#/schematron/peppol/r/peppol-en16931-r100.ts';\nimport { validatePeppolEn16931R101 } from '#/schematron/peppol/r/peppol-en16931-r101.ts';\nimport { validatePeppolEn16931R110 } from '#/schematron/peppol/r/peppol-en16931-r110.ts';\nimport { validatePeppolEn16931R111 } from '#/schematron/peppol/r/peppol-en16931-r111.ts';\nimport { validatePeppolEn16931R120 } from '#/schematron/peppol/r/peppol-en16931-r120.ts';\nimport { validatePeppolEn16931R121 } from '#/schematron/peppol/r/peppol-en16931-r121.ts';\nimport { validatePeppolEn16931R130 } from '#/schematron/peppol/r/peppol-en16931-r130.ts';\nimport { validateSeR001 } from '#/schematron/se/se-r-001.ts';\nimport { validateSeR002 } from '#/schematron/se/se-r-002.ts';\nimport { validateSeR003 } from '#/schematron/se/se-r-003.ts';\nimport { validateSeR004 } from '#/schematron/se/se-r-004.ts';\nimport { validateSeR005 } from '#/schematron/se/se-r-005.ts';\nimport { validateSeR006 } from '#/schematron/se/se-r-006.ts';\nimport { validateSeR007 } from '#/schematron/se/se-r-007.ts';\nimport { validateSeR008 } from '#/schematron/se/se-r-008.ts';\nimport { validateSeR009 } from '#/schematron/se/se-r-009.ts';\nimport { validateSeR010 } from '#/schematron/se/se-r-010.ts';\nimport { validateSeR011 } from '#/schematron/se/se-r-011.ts';\nimport { validateSeR012 } from '#/schematron/se/se-r-012.ts';\nimport { validateSeR013 } from '#/schematron/se/se-r-013.ts';\n\nexport const ruleValidators: ReadonlyArray<SchematronDocumentValidator> = [\n validateCenEn16931BrAe01,\n validateCenEn16931BrAe02,\n validateCenEn16931BrAe03,\n validateCenEn16931BrAe04,\n validateCenEn16931BrAe05,\n validateCenEn16931BrAe06,\n validateCenEn16931BrAe07,\n validateCenEn16931BrAe08,\n validateCenEn16931BrAe09,\n validateCenEn16931BrAe10,\n validateCenEn16931BrAf01,\n validateCenEn16931BrAf02,\n validateCenEn16931BrAf03,\n validateCenEn16931BrAf04,\n validateCenEn16931BrAf05,\n validateCenEn16931BrAf06,\n validateCenEn16931BrAf07,\n validateCenEn16931BrAf08,\n validateCenEn16931BrAf09,\n validateCenEn16931BrAf10,\n validateCenEn16931BrAg01,\n validateCenEn16931BrAg02,\n validateCenEn16931BrAg03,\n validateCenEn16931BrAg04,\n validateCenEn16931BrAg05,\n validateCenEn16931BrAg06,\n validateCenEn16931BrAg07,\n validateCenEn16931BrAg08,\n validateCenEn16931BrAg09,\n validateCenEn16931BrAg10,\n validateCenEn16931BrB01,\n validateCenEn16931BrB02,\n validateCenEn16931Br01,\n validateCenEn16931Br02,\n validateCenEn16931Br03,\n validateCenEn16931Br04,\n validateCenEn16931Br05,\n validateCenEn16931Br06,\n validateCenEn16931Br07,\n validateCenEn16931Br08,\n validateCenEn16931Br09,\n validateCenEn16931Br10,\n validateCenEn16931Br11,\n validateCenEn16931Br12,\n validateCenEn16931Br13,\n validateCenEn16931Br14,\n validateCenEn16931Br15,\n validateCenEn16931Br16,\n validateCenEn16931Br17,\n validateCenEn16931Br18,\n validateCenEn16931Br19,\n validateCenEn16931Br20,\n validateCenEn16931Br21,\n validateCenEn16931Br22,\n validateCenEn16931Br23,\n validateCenEn16931Br24,\n validateCenEn16931Br25,\n validateCenEn16931Br26,\n validateCenEn16931Br27,\n validateCenEn16931Br28,\n validateCenEn16931Br29,\n validateCenEn16931Br30,\n validateCenEn16931Br31,\n validateCenEn16931Br32,\n validateCenEn16931Br33,\n validateCenEn16931Br36,\n validateCenEn16931Br37,\n validateCenEn16931Br38,\n validateCenEn16931Br41,\n validateCenEn16931Br42,\n validateCenEn16931Br43,\n validateCenEn16931Br44,\n validateCenEn16931Br45,\n validateCenEn16931Br46,\n validateCenEn16931Br47,\n validateCenEn16931Br48,\n validateCenEn16931Br49,\n validateCenEn16931Br50,\n validateCenEn16931Br51,\n validateCenEn16931Br52,\n validateCenEn16931Br53,\n validateCenEn16931Br54,\n validateCenEn16931Br55,\n validateCenEn16931Br56,\n validateCenEn16931Br57,\n validateCenEn16931Br61,\n validateCenEn16931Br62,\n validateCenEn16931Br63,\n validateCenEn16931Br64,\n validateCenEn16931Br65,\n validateCenEn16931BrCl08,\n validateCenEn16931BrCo03,\n validateCenEn16931BrCo04,\n validateCenEn16931BrCo05,\n validateCenEn16931BrCo06,\n validateCenEn16931BrCo07,\n validateCenEn16931BrCo08,\n validateCenEn16931BrCo09,\n validateCenEn16931BrCo10,\n validateCenEn16931BrCo11,\n validateCenEn16931BrCo12,\n validateCenEn16931BrCo13,\n validateCenEn16931BrCo14,\n validateCenEn16931BrCo15,\n validateCenEn16931BrCo16,\n validateCenEn16931BrCo17,\n validateCenEn16931BrCo18,\n validateCenEn16931BrCo19,\n validateCenEn16931BrCo20,\n validateCenEn16931BrCo21,\n validateCenEn16931BrCo22,\n validateCenEn16931BrCo23,\n validateCenEn16931BrCo24,\n validateCenEn16931BrCo25,\n validateCenEn16931BrCo26,\n validateCenEn16931BrDec01,\n validateCenEn16931BrDec02,\n validateCenEn16931BrDec05,\n validateCenEn16931BrDec06,\n validateCenEn16931BrDec09,\n validateCenEn16931BrDec10,\n validateCenEn16931BrDec11,\n validateCenEn16931BrDec12,\n validateCenEn16931BrDec13,\n validateCenEn16931BrDec14,\n validateCenEn16931BrDec15,\n validateCenEn16931BrDec16,\n validateCenEn16931BrDec17,\n validateCenEn16931BrDec18,\n validateCenEn16931BrDec19,\n validateCenEn16931BrDec20,\n validateCenEn16931BrDec23,\n validateCenEn16931BrDec24,\n validateCenEn16931BrDec25,\n validateCenEn16931BrDec27,\n validateCenEn16931BrDec28,\n validateCenEn16931BrE01,\n validateCenEn16931BrE02,\n validateCenEn16931BrE03,\n validateCenEn16931BrE04,\n validateCenEn16931BrE05,\n validateCenEn16931BrE06,\n validateCenEn16931BrE07,\n validateCenEn16931BrE08,\n validateCenEn16931BrE09,\n validateCenEn16931BrE10,\n validateCenEn16931BrG01,\n validateCenEn16931BrG02,\n validateCenEn16931BrG03,\n validateCenEn16931BrG04,\n validateCenEn16931BrG05,\n validateCenEn16931BrG06,\n validateCenEn16931BrG07,\n validateCenEn16931BrG08,\n validateCenEn16931BrG09,\n validateCenEn16931BrG10,\n validateCenEn16931BrIc01,\n validateCenEn16931BrIc02,\n validateCenEn16931BrIc03,\n validateCenEn16931BrIc04,\n validateCenEn16931BrIc05,\n validateCenEn16931BrIc06,\n validateCenEn16931BrIc07,\n validateCenEn16931BrIc08,\n validateCenEn16931BrIc09,\n validateCenEn16931BrIc10,\n validateCenEn16931BrIc11,\n validateCenEn16931BrIc12,\n validateCenEn16931BrO01,\n validateCenEn16931BrO02,\n validateCenEn16931BrO03,\n validateCenEn16931BrO04,\n validateCenEn16931BrO05,\n validateCenEn16931BrO06,\n validateCenEn16931BrO07,\n validateCenEn16931BrO08,\n validateCenEn16931BrO09,\n validateCenEn16931BrO10,\n validateCenEn16931BrO11,\n validateCenEn16931BrO12,\n validateCenEn16931BrO13,\n validateCenEn16931BrO14,\n validateCenEn16931BrS01,\n validateCenEn16931BrS02,\n validateCenEn16931BrS03,\n validateCenEn16931BrS04,\n validateCenEn16931BrS05,\n validateCenEn16931BrS06,\n validateCenEn16931BrS07,\n validateCenEn16931BrS08,\n validateCenEn16931BrS09,\n validateCenEn16931BrS10,\n validateCenEn16931BrZ01,\n validateCenEn16931BrZ02,\n validateCenEn16931BrZ03,\n validateCenEn16931BrZ04,\n validateCenEn16931BrZ05,\n validateCenEn16931BrZ06,\n validateCenEn16931BrZ07,\n validateCenEn16931BrZ08,\n validateCenEn16931BrZ09,\n validateCenEn16931BrZ10,\n validateDeR001,\n validateDeR002,\n validateDeR003,\n validateDeR004,\n validateDeR005,\n validateDeR006,\n validateDeR007,\n validateDeR008,\n validateDeR009,\n validateDeR010,\n validateDeR011,\n validateDeR014,\n validateDeR015,\n validateDeR016,\n validateDeR017,\n validateDeR018,\n validateDeR019,\n validateDeR020,\n validateDeR022,\n validateDeR023_1,\n validateDeR023_2,\n validateDeR024_1,\n validateDeR024_2,\n validateDeR025_1,\n validateDeR025_2,\n validateDeR026,\n validateDeR027,\n validateDeR028,\n validateDeR030,\n validateDeR031,\n validateDkR002,\n validateDkR003,\n validateDkR004,\n validateDkR005,\n validateDkR006,\n validateDkR007,\n validateDkR008,\n validateDkR009,\n validateDkR010,\n validateDkR011,\n validateDkR013,\n validateDkR014,\n validateDkR016,\n validateDkR017,\n validateGrR001_1,\n validateGrR001_2,\n validateGrR001_3,\n validateGrR001_4,\n validateGrR001_5,\n validateGrR001_6,\n validateGrR001_7,\n validateGrR002,\n validateGrR003,\n validateGrR004_1,\n validateGrR004_2,\n validateGrR005,\n validateGrR006,\n validateGrR008_2,\n validateGrR008_3,\n validateGrR009,\n validateGrR010,\n validateGrS008_1,\n validateGrS011,\n validateIsR001,\n validateIsR002,\n validateIsR003,\n validateIsR004,\n validateIsR005,\n validateIsR006,\n validateIsR007,\n validateIsR008,\n validateIsR009,\n validateIsR010,\n validateItR001,\n validateItR002,\n validateItR003,\n validateItR004,\n validateNlR001,\n validateNlR002,\n validateNlR003,\n validateNlR004,\n validateNlR005,\n validateNlR006,\n validateNlR007,\n validateNlR008,\n validateNlR009,\n validateNoR001,\n validateNoR002,\n validatePeppolEn16931CL001,\n validatePeppolEn16931CL002,\n validatePeppolEn16931CL003,\n validatePeppolEn16931CL006,\n validatePeppolEn16931CL007,\n validatePeppolEn16931CL008,\n validatePeppolCommonR040,\n validatePeppolCommonR041,\n validatePeppolCommonR042,\n validatePeppolCommonR043,\n validatePeppolCommonR044,\n validatePeppolCommonR045,\n validatePeppolCommonR046,\n validatePeppolCommonR047,\n validatePeppolCommonR049,\n validatePeppolCommonR050,\n validatePeppolCommonR052,\n validatePeppolCommonR053,\n validatePeppolEn16931F001,\n validatePeppolEn16931P0100,\n validatePeppolEn16931P0101,\n validatePeppolEn16931P0104,\n validatePeppolEn16931P0105,\n validatePeppolEn16931P0106,\n validatePeppolEn16931P0107,\n validatePeppolEn16931P0108,\n validatePeppolEn16931P0109,\n validatePeppolEn16931P0110,\n validatePeppolEn16931P0111,\n validatePeppolEn16931P0112,\n validatePeppolEn16931R001,\n validatePeppolEn16931R002,\n validatePeppolEn16931R003,\n validatePeppolEn16931R004,\n validatePeppolEn16931R005,\n validatePeppolEn16931R007,\n validatePeppolEn16931R008,\n validatePeppolEn16931R010,\n validatePeppolEn16931R020,\n validatePeppolEn16931R040,\n validatePeppolEn16931R041,\n validatePeppolEn16931R042,\n validatePeppolEn16931R043,\n validatePeppolEn16931R044,\n validatePeppolEn16931R046,\n validatePeppolEn16931R051,\n validatePeppolEn16931R053,\n validatePeppolEn16931R054,\n validatePeppolEn16931R055,\n validatePeppolEn16931R061,\n validatePeppolEn16931R100,\n validatePeppolEn16931R101,\n validatePeppolEn16931R110,\n validatePeppolEn16931R111,\n validatePeppolEn16931R120,\n validatePeppolEn16931R121,\n validatePeppolEn16931R130,\n validateSeR001,\n validateSeR002,\n validateSeR003,\n validateSeR004,\n validateSeR005,\n validateSeR006,\n validateSeR007,\n validateSeR008,\n validateSeR009,\n validateSeR010,\n validateSeR011,\n validateSeR012,\n validateSeR013,\n];\n","import type { Result } from 'effect';\n\nimport { Context, Effect, Layer } from 'effect';\n\nimport type { PeppolDocument } from '#/schemas/peppol-document-schema.ts';\n\nimport { SchematronValidationError } from '#/schematron/errors.ts';\nimport { ruleValidators } from '#/schematron/run-all-rules.ts';\n\n/**\n * @description The `Schematron` service validates a document against every schematron rule.\n */\nexport interface SchematronShape {\n /**\n * @description Runs every schematron rule against the document, failing with a single `SchematronValidationError` that wraps each failed rule.\n */\n readonly run: (document: PeppolDocument) => Effect.Effect<Result.Result<void, SchematronValidationError>>;\n}\n\n/**\n * @description Runs the schematron rules of this library against a PEPPOL document.\n */\nexport class Schematron extends Context.Service<Schematron, SchematronShape>()('@endevops/peppol-schema/schematron/Schematron') {\n static readonly layer = Layer.effect(\n Schematron,\n Effect.gen(function* () {\n const run = Effect.fn('Schematron.run')(function* (document: PeppolDocument) {\n const [errors] = yield* Effect.partition(ruleValidators, validator => validator(document));\n if (errors.length > 0) {\n return yield* new SchematronValidationError({ errors });\n }\n }, Effect.result);\n return Schematron.of({ run });\n })\n );\n}\n"],"mappings":";;;;;;;;;AAKA,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAAC,uBAAuB;CACxG,IAAI,OAAO;CACX,OAAO,OAAO,SAAS,CAAC,SAAS,SAAS,CAAC;CAC3C,SAAS,OAAO;AAClB,CAAC,CAAC,CAAC,CAAC;;;;AAKJ,IAAa,4BAAb,cAA+C,OAAO,YAAuC,CAAC,CAAC,6BAA6B,EAC1H,QAAQ,OAAO,MAAM,mBAAmB,EAC1C,CAAC,CAAC,CAAC,CAAC;;;;;;ACcJ,SAAgB,eAAe,MAAsB,WAA+E;CAClI,OAAO,OAAO,GAAG,cAAc,KAAK,IAAI,CAAC,CAAC,WAAW,UAA0B;EAC7E,IA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SAAS;AACX;AAEA,SAAS,eAAe,UAAmC;CACzD,IAAI,mBAAmB,QAAQ,MAAM,MACnC,OAAO;CAET,MAAM,YAAY,SAAS,wBAAwB,iBAAiB;CACpE,OAAO,cAAc,KAAA,KAAa,aAAa,UAAU,EAAE;AAC7D;AAEA,MAAa,iBAAiB,eAAe,MAAM,cAAc;;;ACuVjE,MAAa,iBAA6D;CACxE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AC9rBA,IAAa,aAAb,MAAa,mBAAmB,QAAQ,QAAqC,CAAC,CAAC,+CAA+C,CAAC,CAAC;CAC9H,OAAgB,QAAQ,MAAM,OAC5B,YACA,OAAO,IAAI,aAAa;EACtB,MAAM,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,UAA0B;GAC3E,MAAM,CAAC,UAAU,OAAO,OAAO,UAAU,iBAAgB,cAAa,UAAU,QAAQ,CAAC;GACzF,IAAI,OAAO,SAAS,GAClB,OAAO,OAAO,IAAI,0BAA0B,EAAE,OAAO,CAAC;EAE1D,GAAG,OAAO,MAAM;EAChB,OAAO,WAAW,GAAG,EAAE,IAAI,CAAC;CAC9B,CAAC,CACH;AACF"}