<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://dtd.riege.com/scope/webservices/commonFinanceDataTypes-v1"
            xmlns:cdt="http://dtd.riege.com/scope/webservices/commonDataTypes-v1"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://dtd.riege.com/scope/webservices/commonFinanceDataTypes-v1"
            elementFormDefault="qualified"
            version="1.0">

    <xsd:annotation>
        <xsd:appinfo>
            <lastChangeDate>2026-07-09</lastChangeDate>
            <version>1.0.0</version>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:import namespace="http://dtd.riege.com/scope/webservices/commonDataTypes-v1"
                schemaLocation="commonDataTypes-v1.xsd"/>

    <xsd:complexType name="chargeConstructionType">
        <xsd:annotation>
            <xsd:documentation>
                Data type describing the charge construction, i.e. the calculation setup used to
                derive a monetary result from tariff basis, method and rates
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="type" type="chargeConstructionTypeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Category of the calculation, for example fixed, rate-based, minimum, or an
                        error state
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="basis" type="calculationBasisType" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Input basis used by the tariff, such as weight, volume, pieces, or
                        other
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="method" type="calculationMethodType" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Calculation method applied to the basis value, for example fix,
                        proportional, or step
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="baseValue" type="xsd:decimal" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Effective basis quantity used for the calculation
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="containerTypeIdentifier" type="cdt:identifierType" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of the container type used when the tariff basis depends on
                        container type
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="containerTypeCode" type="cdt:containerTypeCodeType" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Code of the container type used when the tariff basis depends on container
                        type
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="rate" type="xsd:decimal" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Rate applied to the calculated basis value
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="baseUnits" type="xsd:decimal" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of units to which the rate refers (for example rate per 100 kg).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="baseUnit" type="cdt:allUnitTypesType" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Unit of measure for basis and rate interpretation
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="volumeFactor" type="xsd:decimal" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Conversion factor used to derive chargeable weight from gross weight where
                        applicable
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="freeUnits" type="xsd:integer" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of free units considered in the tariff setup. These units are
                        already deducted from the effective base value
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="minimumAmount" type="xsd:decimal" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Minimum amount enforced by the tariff for this charge construction
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

            <xsd:element name="result" type="xsd:decimal" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Calculated monetary result
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="currency" type="cdt:currencyCodeType" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Currency code of the calculated result amount
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="chargeConstructionTypeType">
        <xsd:annotation>
            <xsd:documentation>type of the calculation, for example fixed, rate-based, minimum, or
                an error state
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="fix">
                <xsd:annotation>
                    <xsd:documentation>The calculation is based on a fixed amount
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="minimum">
                <xsd:annotation>
                    <xsd:documentation>The minimum amount of a tariff is applied</xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="rate">
                <xsd:annotation>
                    <xsd:documentation>The calculation is based on a given rate</xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="notPresentable">
                <xsd:annotation>
                    <xsd:documentation>The calculation is not presentable</xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="errorMissingBaseValue">
                <xsd:annotation>
                    <xsd:documentation>The base value for a tariff calculation is missing
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="errorAmountChargeTypeTariffMissingBaseCharges">
                <xsd:annotation>
                    <xsd:documentation>A tariff based on other charge types could not be applied due
                        to missing base charges
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="errorAmountChargeTypeTariffEmptyAmount">
                <xsd:annotation>
                    <xsd:documentation>A tariff based on other charge types could not be applied due
                        to empty amounts
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="errorAmountChargeTypeTariffDifferentCurrencies">
                <xsd:annotation>
                    <xsd:documentation>A tariff based on other charge types could not be applied due
                        to different currencies in base amounts
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="calculationBasisType">
        <xsd:annotation>
            <xsd:documentation>
                Defines the available bases used by tariffs to calculate income and cost amounts
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="baseAmountOnly">
                <xsd:annotation>
                    <xsd:documentation>Uses only the configured base amount without applying a
                        quantity basis
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="manual">
                <xsd:annotation>
                    <xsd:documentation>Input value is entered manually and not derived from order
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="numberOfPieces">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on the total number of pieces
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="numberOfPiecesDgr">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on the number of dangerous-goods
                        pieces
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="chargeableWeight">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on chargeable weight
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="grossWeight">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on gross weight
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="volume">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on volume</xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="weightOrMeasurement">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated using weight or measurement
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="loadingMetre">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on loading metres
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="containerCount">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on the number of containers
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="containerTeu">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on total TEU</xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="containerType">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on container type
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="storageTime">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on storage duration
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="resourceTime">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on the time a resource is used
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="amountChargeTypeIncome">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on income amounts of a specific charge type
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="amountChargeTypeCost">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on cost amounts of a specific charge type
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="amountChargeTypeListIncome">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on income amounts of a list of charge types
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="amountChargeTypeListCost">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on cost amounts of a list of charge types
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="amountAllCharges">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on the sum of all income charge amounts
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="amountInsuranceValue">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated from the declared insurance value
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="otherTariff">
                <xsd:annotation>
                    <xsd:documentation>Amount is derived from another tariff result
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="importFreightCollectCharges">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on import freight collect charges
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="importOtherCollectCharges">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on other collect charges for import
                        shipments
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="quayCharges">
                <xsd:annotation>
                    <xsd:documentation>Amount is based on quay charges</xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="customsProceduresCount">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on the number of customs
                        procedures
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="customsPositionsCount">
                <xsd:annotation>
                    <xsd:documentation>Amount is calculated based on the number of positions of a
                        customs declaration
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="calculationMethodType">
        <xsd:annotation>
            <xsd:documentation>Defines the available methods for calculating the result for a given
                input value
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="fix">
                <xsd:annotation>
                    <xsd:documentation>The amount fix regardless of the input value
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="proportional">
                <xsd:annotation>
                    <xsd:documentation>The amount is calculated proportionally to the given input
                        value
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="step">
                <xsd:annotation>
                    <xsd:documentation>The amount is calculated in steps of units
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

</xsd:schema>
