<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.1.2">
    <!--=====================================================================-->
    <!--                        Schema Management                            -->
    <!--=====================================================================-->
    <!--                             IMPORTS                                 -->
    <!--                          DOCUMENTATION                              -->
    <xsd:annotation>
        <xsd:documentation xml:lang="en"/>
        <xsd:documentation>
            <name>CCBRCheck Interface</name>
            <revision version="1.0.0">
                <date>2023-MAR-10</date>
            </revision>
        </xsd:documentation>
    </xsd:annotation>
    <!--                             INCLUDE                                 -->
    <!--                            REDEFINE                                 -->
    <!--=====================================================================-->
    <!--                    Model-Building Components                        -->
    <!--=====================================================================-->
    <!--                            NOTATIONS                                -->
    <!--                           SIMPLE TYPES                              -->
    <xsd:simpleType name="ModeSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:enumeration value="direct"/>
            <xsd:enumeration value="batch"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="BatchIdentifierSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:minLength value="22"/>
            <xsd:maxLength value="150"/>
            <xsd:pattern value="[A-Z]{1,4}-[A-Z,0-9]{1,32}-[A-Z,0-9]{1,32}-([A-Z]{1,32}-){0,2}[0-9]{17}"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="IdentifierSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="32"/>
            <xsd:pattern value="[0-9a-zA-Z]{1,32}"/>
        </xsd:restriction>
    </xsd:simpleType>
   
    <xsd:simpleType name="VersionSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:pattern value="[0-9].[0-9]"/>
        </xsd:restriction>
    </xsd:simpleType>
        
    <xsd:simpleType name="DateSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:minLength value="10"/>
            <xsd:maxLength value="10"/>
            <xsd:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="DateTimeSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:minLength value="24"/>
            <xsd:maxLength value="24"/>
            <xsd:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="MessageCountSimpleType">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:minInclusive value="0"/>
            <xsd:maxInclusive value="3000"/>
        </xsd:restriction>
    </xsd:simpleType>
            
    <xsd:simpleType name="DebtorReferenceSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="35"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="TokenLength128SimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:maxLength value="128"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TokenLength256SimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:maxLength value="256"/>
        </xsd:restriction>
    </xsd:simpleType>

    
    <xsd:simpleType name="TokenLength200SimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:maxLength value="200"/>
        </xsd:restriction>
    </xsd:simpleType>
    
   <xsd:simpleType name="RestrictedTokenLength200SimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:maxLength value="200"/>
            <xsd:pattern value="[a-zA-ZOáÁćĆéÉíÍĺĹńŃóÓŕŔśŚúÚẃẂýÝźŹàÀèÈìÌòÒùÙẁẀỳỲàÀèÈìÌòÒùÙẁẀỳỲâÂĉĈêÊĝĜĥĤîÎĵĴôÔŝŜûÛŵŴŷŶäÄëËïÏöÖüÜẅẄŸãÃñÑõÕčČďĎěĚľĽňŇřŘšŠťŤžŽăĂğĞŭŬőŐűŰåÅůŮċĊėĖġĠİıżŻāĀēĒīĪōŌūŪđĐħĦłŁøŧŦçÇģĢķĶļĻņŅŗŖşŞţŢąĄęĘįĮųŲæÆĳĲœŒßŋŊðÐþÞĩĨũŨĸŀĿŉ’&apos; -]{1,200}"/>

        </xsd:restriction>
    </xsd:simpleType>

    
    <xsd:simpleType name="TokenLength64SimpleType">
        <xsd:restriction base="xsd:token"> 
            <xsd:maxLength value="64"/>
        </xsd:restriction>
    </xsd:simpleType>

        
   <xsd:simpleType name="TokenLength10SimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:maxLength value="10"/>
        </xsd:restriction>
    </xsd:simpleType>
 
    <xsd:simpleType name="EntranceCodeSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="40"/>
            <xsd:pattern value="[0-9a-zA-Z]{1,40}"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="ErrorCodeSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:pattern value="[A-Z]{2}[0-9]{4}"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="CCBRResultSimpleType">
        <xsd:restriction base="xsd:token">
            <xsd:enumeration value="true"/>
            <xsd:enumeration value="false"/>
            <xsd:enumeration value="uncertain"/>
         </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TransactionIDType">
        <xsd:restriction base="xsd:token">
            <xsd:pattern value="[0-9a-zA-Z]{1,64}"/>
        </xsd:restriction>
    </xsd:simpleType>

    <!--                          COMPLEX TYPES                              -->
 
    <!--                          ROOT ELEMENT TYPE                          -->
    <xsd:complexType name="CCBRCheckInterfaceType">
        <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <xsd:element name="CCBRCheckTransactionRequest"  type="CCBRCheckTransactionRequestType" maxOccurs="1"/>
            <xsd:element name="CCBRCheckTransactionResponse" type="CCBRCheckTransactionResponseType" maxOccurs="1"/>
            <xsd:element name="CCBRCheckErrorResponse"       type="CCBRCheckErrorResponseType" minOccurs="0" maxOccurs="1"/>
        </xsd:choice>
        <xsd:attributeGroup ref="HeaderAttributes"/>
    </xsd:complexType>
    
    <!--                      COMPLEX TYPES DESCRIBING MAIN DOCUMENTS TYPES  -->
     <xsd:complexType name="CCBRCheckTransactionRequestType">
        <xsd:all>
            <xsd:element name="FirstNames" type="TokenLength200SimpleType" minOccurs="0"/>
            <xsd:element name="SurnamePrefix" type="TokenLength10SimpleType" minOccurs="0"/>
            <xsd:element name="Surname" type="RestrictedTokenLength200SimpleType"/>
            <xsd:element name="BirthDate" type="DateSimpleType"/>
            <xsd:element name="BirthPlace" type="TokenLength64SimpleType" minOccurs="0"/>
			<xsd:element name="DebtorReference" type="DebtorReferenceSimpleType" minOccurs="0"/>

        </xsd:all>
        <xsd:attributeGroup ref="RequestAttributes"/>
    </xsd:complexType>
        
            
    <xsd:complexType name="CCBRCheckTransactionResponseType">
       <xsd:sequence>
            <xsd:choice maxOccurs="1" minOccurs="1">
            	<xsd:element name="CCBRCheckResult" type="CCBRCheckResultType"/>
                <xsd:element name="Error" type="ErrorComplexType" maxOccurs="1"/>
            </xsd:choice>
            <xsd:element name="DebtorReference"  type="DebtorReferenceSimpleType"  minOccurs="0"/>
            <xsd:element name="TransactionID" type="TransactionIDType" minOccurs="0"/>
       </xsd:sequence>
        <xsd:attributeGroup ref="RequestAttributes"/>
    </xsd:complexType>
    
    
    <xsd:complexType name="CCBRCheckErrorResponseType">
        <xsd:sequence>
            <xsd:element name="Error" type="ErrorComplexType" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
             
    <!--                      OTHER COMPLEX TYPES                            -->    
    <xsd:complexType name="ErrorComplexType">
        <xsd:sequence>
            <xsd:element name="ErrorCode" type="ErrorCodeSimpleType"/>
            <xsd:element name="ErrorMessage" type="TokenLength128SimpleType"/>
            <xsd:element name="ErrorDetail" type="TokenLength256SimpleType" minOccurs="0"/>
            <xsd:element name="Object" type="TokenLength256SimpleType" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>
    
    
    <!-- CCBRCheckResult -->
    <xsd:complexType name="CCBRCheckResultType">
        <xsd:all>
            <xsd:element name="IsRegistered" type="CCBRResultSimpleType"/>
            <xsd:element name="RegistrationCardsCount" type="xsd:nonNegativeInteger" minOccurs="0"/>
			<xsd:element name="RegistrationCards" type="CCBRRegistrationCardsComplexType" minOccurs="0"/>
		</xsd:all>
    </xsd:complexType>
    
    <!-- RegistrationCards array -->
    <xsd:complexType name="CCBRRegistrationCardsComplexType" mixed="true">
        <xsd:sequence>
            <xsd:element name="CCBRRegistrationCard" type="CCBRRegistrationCardType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    
       <!-- RegistrationCard -->
    <xsd:complexType name="CCBRRegistrationCardType">
        <xsd:all>
            <xsd:element name="FirstNames" type="TokenLength200SimpleType" minOccurs="0"/>
            <xsd:element name="SurnamePrefix" type="TokenLength10SimpleType" minOccurs="0"/>
            <xsd:element name="Surname" type="TokenLength200SimpleType"/>
            <xsd:element name="BirthDate" type="DateSimpleType"/>
            <xsd:element name="BirthPlace" type="TokenLength64SimpleType" minOccurs="0"/>
            <xsd:element name="BirthCountry" type="TokenLength64SimpleType" minOccurs="0"/>
            <xsd:element name="HundredPercentMatch" type="xsd:boolean"/>
            <xsd:element name="RegistrationCardIDCode" type="TokenLength64SimpleType"/>
            <xsd:element name="RegisterType" type="TokenLength64SimpleType"/>

        </xsd:all>
    </xsd:complexType>

    
      
    <!--                        ATTRIBUTE GROUPS                             -->
    <xsd:attributeGroup name="HeaderAttributes">
        <xsd:attribute name="mode"           type="ModeSimpleType" use="required"/>
        <xsd:attribute name="batchID"        type="BatchIdentifierSimpleType"/>
        <xsd:attribute name="senderID"       type="IdentifierSimpleType" use="required"/>
        <xsd:attribute name="version"        type="VersionSimpleType" default="1.0"/>
        <xsd:attribute name="createDateTime" type="DateTimeSimpleType" use="required"/>
        <xsd:attribute name="messageCount"   type="MessageCountSimpleType" use="required"/>
        <xsd:attribute name="type" use="required">
            <xsd:simpleType>
                <xsd:restriction base="xsd:token">
                    <xsd:enumeration value="TransactionRequest"/>
                    <xsd:enumeration value="TransactionResponse"/>
                    <xsd:enumeration value="ErrorResponse"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
    </xsd:attributeGroup>
    
    <xsd:attributeGroup name="RequestAttributes">
    	<xsd:attribute name="entranceCode" type="EntranceCodeSimpleType"/>
    </xsd:attributeGroup>
    <!--                            ATTRIBUTES                               -->
    
    <!--                              GROUPS                                 -->
    
    <!--                             ELEMENTS                                -->
    <xsd:element name="CCBRCheckInterface" type="CCBRCheckInterfaceType"/>
    
</xsd:schema>