pub static ORDER: &[(&str, &[&str])] = &[
(
"AdditionalDocumentReference",
&[
"ID",
"DocumentDescription",
"Attachment",
"DocumentTypeCode",
],
),
("AdditionalItemProperty", &["Name", "Value"]),
(
"Address",
&[
"StreetName",
"AdditionalStreetName",
"CityName",
"PostalZone",
"CountrySubentity",
"AddressLine",
"Country",
],
),
(
"AllowanceCharge",
&[
"ChargeIndicator",
"AllowanceChargeReasonCode",
"AllowanceChargeReason",
"MultiplierFactorNumeric",
"Amount",
"BaseAmount",
"TaxCategory",
],
),
(
"Attachment",
&["EmbeddedDocumentBinaryObject", "ExternalReference"],
),
(
"CardAccount",
&["PrimaryAccountNumberID", "NetworkID", "HolderName"],
),
("ClassifiedTaxCategory", &["ID", "Percent", "TaxScheme"]),
("Contact", &["Name", "Telephone", "ElectronicMail"]),
(
"CreditNote",
&[
"UBLVersionID",
"CustomizationID",
"ProfileID",
"ID",
"IssueDate",
"TaxPointDate",
"CreditNoteTypeCode",
"Note",
"DocumentCurrencyCode",
"TaxCurrencyCode",
"AccountingCost",
"BuyerReference",
"InvoicePeriod",
"OrderReference",
"BillingReference",
"DespatchDocumentReference",
"ReceiptDocumentReference",
"ContractDocumentReference",
"AdditionalDocumentReference",
"OriginatorDocumentReference",
"AccountingSupplierParty",
"AccountingCustomerParty",
"PayeeParty",
"TaxRepresentativeParty",
"Delivery",
"PaymentMeans",
"PaymentTerms",
"AllowanceCharge",
"TaxTotal",
"LegalMonetaryTotal",
"CreditNoteLine",
],
),
(
"CreditNoteLine",
&[
"ID",
"Note",
"CreditedQuantity",
"LineExtensionAmount",
"AccountingCost",
"InvoicePeriod",
"OrderLineReference",
"DocumentReference",
"AllowanceCharge",
"Item",
"Price",
],
),
(
"Delivery",
&["ActualDeliveryDate", "DeliveryLocation", "DeliveryParty"],
),
("DeliveryLocation", &["ID", "Address"]),
("DocumentReference", &["ID", "DocumentTypeCode"]),
(
"Invoice",
&[
"UBLExtensions",
"UBLVersionID",
"CustomizationID",
"ProfileID",
"ID",
"IssueDate",
"DueDate",
"InvoiceTypeCode",
"Note",
"TaxPointDate",
"DocumentCurrencyCode",
"TaxCurrencyCode",
"AccountingCost",
"BuyerReference",
"InvoicePeriod",
"OrderReference",
"BillingReference",
"DespatchDocumentReference",
"ReceiptDocumentReference",
"OriginatorDocumentReference",
"ContractDocumentReference",
"AdditionalDocumentReference",
"ProjectReference",
"AccountingSupplierParty",
"AccountingCustomerParty",
"PayeeParty",
"TaxRepresentativeParty",
"Delivery",
"PaymentMeans",
"PaymentTerms",
"PrepaidPayment",
"AllowanceCharge",
"TaxTotal",
"LegalMonetaryTotal",
"InvoiceLine",
],
),
("InvoiceDocumentReference", &["ID", "IssueDate"]),
(
"InvoiceLine",
&[
"ID",
"Note",
"InvoicedQuantity",
"LineExtensionAmount",
"AccountingCost",
"InvoicePeriod",
"OrderLineReference",
"DocumentReference",
"AllowanceCharge",
"Item",
"Price",
"SubInvoiceLine",
],
),
(
"InvoicePeriod",
&["StartDate", "EndDate", "DescriptionCode"],
),
(
"Item",
&[
"Description",
"Name",
"BuyersItemIdentification",
"SellersItemIdentification",
"StandardItemIdentification",
"OriginCountry",
"CommodityClassification",
"ClassifiedTaxCategory",
"AdditionalItemProperty",
],
),
(
"LegalMonetaryTotal",
&[
"LineExtensionAmount",
"TaxExclusiveAmount",
"TaxInclusiveAmount",
"AllowanceTotalAmount",
"ChargeTotalAmount",
"PrepaidAmount",
"PayableRoundingAmount",
"PayableAmount",
],
),
("OrderLineReference", &["LineID", "OrderReference"]),
("OrderReference", &["ID", "SalesOrderID"]),
(
"Party",
&[
"EndpointID",
"PartyIdentification",
"PartyName",
"PostalAddress",
"PartyTaxScheme",
"PartyLegalEntity",
"Contact",
],
),
(
"PartyLegalEntity",
&["RegistrationName", "CompanyID", "CompanyLegalForm"],
),
("PartyTaxScheme", &["CompanyID", "TaxScheme"]),
(
"PayeeFinancialAccount",
&["ID", "Name", "FinancialInstitutionBranch"],
),
(
"PayeeParty",
&["PartyIdentification", "PartyName", "PartyLegalEntity"],
),
("PaymentMandate", &["ID", "PayerFinancialAccount"]),
(
"PaymentMeans",
&[
"PaymentMeansCode",
"PaymentID",
"CardAccount",
"PayeeFinancialAccount",
"CreditAccount",
"PaymentMandate",
],
),
(
"PostalAddress",
&[
"StreetName",
"AdditionalStreetName",
"CityName",
"PostalZone",
"CountrySubentity",
"AddressLine",
"Country",
],
),
("PrepaidPayment", &["ID", "PaidAmount", "InstructionID"]),
("Price", &["PriceAmount", "BaseQuantity", "AllowanceCharge"]),
(
"SubInvoiceLine",
&[
"ID",
"InvoicedQuantity",
"LineExtensionAmount",
"Item",
"Price",
"SubInvoiceLine",
],
),
(
"TaxCategory",
&[
"ID",
"Percent",
"TaxExemptionReasonCode",
"TaxExemptionReason",
"TaxScheme",
],
),
(
"TaxRepresentativeParty",
&["PartyName", "PostalAddress", "PartyTaxScheme"],
),
(
"TaxSubtotal",
&["TaxableAmount", "TaxAmount", "TaxCategory"],
),
("TaxTotal", &["TaxAmount", "TaxSubtotal"]),
];
#[must_use]
pub fn children_of(parent: &str) -> Option<&'static [&'static str]> {
ORDER
.binary_search_by_key(&parent, |(p, _)| *p)
.ok()
.map(|i| ORDER[i].1)
}
#[must_use]
pub fn index_of(parent: &str, child: &str) -> Option<usize> {
children_of(parent)?.iter().position(|c| *c == child)
}