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

    <xsd:annotation>
        <xsd:appinfo>
            <lastChangeDate>2026-05-13</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:import namespace="http://dtd.riege.com/scope/webservices/commonOrderDataTypes-v1"
                schemaLocation="commonOrderDataTypes-v1.xsd"/>

    <xsd:element name="chargeType" type="chargeTypeType">
        <xsd:annotation>
            <xsd:documentation>Root element holding a single charge type</xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="chargeTypes">
        <xsd:annotation>
            <xsd:documentation>Root element holding a list of charge types</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="chargeType" type="chargeTypeType" minOccurs="0"
                             maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="chargeTypeType">
        <xsd:annotation>
            <xsd:documentation>Charge type data type</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="identifier" type="cdt:identifierType">
                <xsd:annotation>
                    <xsd:documentation>Charge type identifier</xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="lastModified" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>Last modification time of the charge type in UTC
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

            <xsd:element name="code" type="cdt:string6Type">
                <xsd:annotation>
                    <xsd:documentation>Unique charge type code</xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="name" type="cdt:localizedStringType">
                <xsd:annotation>
                    <xsd:documentation>The charge type name, which can optionally be provided in
                        different locales
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

            <xsd:element name="role" type="chargeTypeRoleType">
                <xsd:annotation>
                    <xsd:documentation>The role of this charge type used to identify certain charge
                        types. Each role can only be assigned once within an organization
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="type" type="chargeTypeClassificationType">
                <xsd:annotation>
                    <xsd:documentation>The classification of this charge type mainly for tax
                        purposes
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="transitItem" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>Indicates whether a charge type is excluded from profit
                        reporting, for example when associated income and costs are equal
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="airfreightSurcharge" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>Indicates whether the charge type is classified as an air
                        freight surcharge
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="mainTransportRelated" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>Indicates whether the charge type is classified as main
                        transport related
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

            <xsd:element name="applicationScope" type="applicationScopeType">
                <xsd:annotation>
                    <xsd:documentation>Specifies whether the charge type is eligible for use in
                        accounts receivable, accounts payable, or both
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="restrictedModules" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>Specifies whether the charge type is restricted to specific
                        Scope modules
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="restrictedModule" type="codt:moduleType"
                                     maxOccurs="unbounded"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>

            <xsd:element name="validFrom" type="xsd:date" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>The valid from date (inclusive) for this charge type
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="validTo" type="xsd:date" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>The valid to date (inclusive) for this charge type
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

            <xsd:element name="legalEntitySettings" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>Legal entity specific settings</xsd:documentation>
                </xsd:annotation>
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="legalEntitySetting" type="legalEntitySettingsType"
                                     maxOccurs="unbounded"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="legalEntitySettingsType">
        <xsd:annotation>
            <xsd:documentation>Data type for legal entity specific settings of a charge type
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="generalLedgerFilter" type="cdt:generalLedgerFilterRefType">
                <xsd:annotation>
                    <xsd:documentation>Only charge types with an assigned general ledger filter can
                        be used in a legal entity
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="showChargeConstruction" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>Determines whether the charge construction of a charge line
                        is displayed by default on invoices
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="skipLinesWithoutAmountsOnShipments" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>Specifies whether automated accruals on a shipment without an
                        amount or rate should be created or not created
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="skipLinesWithoutAmountsOnQuotations" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>Specifies whether lines on a quotation without an amount or
                        rate should be created or not created
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>

        <xsd:attribute name="legalEntityCode" type="cdt:legalEntityCodeType" use="required">
            <xsd:annotation>
                <xsd:documentation>Scope legal entity to which the settings apply
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:simpleType name="chargeTypeRoleType">
        <xsd:annotation>
            <xsd:documentation>Charge type role assigned at the time of creation
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="userDefined"/>
            <xsd:enumeration value="airFreight"/>
            <xsd:enumeration value="oceanFreight"/>
            <xsd:enumeration value="oceanFreightFcl"/>
            <xsd:enumeration value="oceanFreightLcl"/>
            <xsd:enumeration value="duty"/>
            <xsd:enumeration value="valueAddedTax"/>
            <xsd:enumeration value="exciseTax"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="chargeTypeClassificationType">
        <xsd:annotation>
            <xsd:documentation>Classification of the charge type mainly for tax purposes
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="service"/>
            <xsd:enumeration value="goods"/>
            <xsd:enumeration value="duties"/>
            <xsd:enumeration value="tax"/>
            <xsd:enumeration value="bollo"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="applicationScopeType">
        <xsd:annotation>
            <xsd:documentation>The application scope of a charge type
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="accountsReceivablesAndPayables"/>
            <xsd:enumeration value="accountsReceivablesOnly"/>
            <xsd:enumeration value="accountsPayablesOnly"/>
        </xsd:restriction>
    </xsd:simpleType>

</xsd:schema>
