<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="http://worldcat.org/xmlschemas/BulkPatronDelete"
           targetNamespace="http://worldcat.org/xmlschemas/BulkPatronDelete"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           xmlns:cdt="http://worldcat.org/xmlschemas/common-types/CommonDataTypes">
    <xs:import namespace="http://worldcat.org/xmlschemas/common-types/CommonDataTypes"
               schemaLocation="http://worldcat.org/xmlschemas/common-types/CommonDataTypes/1.10/CommonDataTypes-1.10.xsd"/>

    <xs:element name="bulkPatronDelete" type="BulkPatronDelete"/>

    <xs:complexType name="BulkPatronDelete">
        <xs:sequence>
            <xs:element name="deleteUser" type="DeleteUser" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        A person or entity in relationship to an authenticating OCLC
                        customer institution.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <!-- Defintion of the structure of the deleteUser element  -->
    <xs:complexType name="DeleteUser">
        <xs:sequence>
            <xs:element name="barcode" type="cdt:string20" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        This is the barcode used by WMS Circulation. ILL processes
                        store the barcode in the ILL Identifier. This value is one
                        of several that are involved in matching an incoming record
                        with an existing record for update. See documentation on the
                        matching logic.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="correlationInfo" type="CorrelationInfo" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Contains the identifier for the person that will be provided
                        by a non-OCLC-managed authentication system.  OCLC requires
                        this element to allow correlation with stored OCLC user data
                        at login time.  Additionally, one or more identifiers from
                        systems other than one used for authentication may be
                        provided to enable correlation with an existing user record
                        for update as part of data ingest if a barcode or ILL
                        identifier is not provided or needs to be changed.

                        Correlation data, the WmsCircPatronInfo/barcode and the
                        WsILLInfo/illId are all compared against data stored in the
                        same fields in the OCLC User Data Service to determine
                        whether the record is meant to update an existing user or to
                        create a new user.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="illId" type="cdt:string254" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        A unique identifier for the user for ILL processes.  It may,
                        but need not be, the user's library barcode. WMS Circulation
                        customers (also) store the barcode in
                        persona.wmsCircPatronInfo.barcode.  This value is one of
                        several that are involved in matching an incoming record
                        with an existing record for update. See documentation on the
                        matching logic.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="institutionId" type="cdt:integerMin1" use="required">
            <xs:annotation>
                <xs:documentation>
                    The OCLC Institution Registry id of the institution that
                    manages the user's record.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="CorrelationInfo">
        <xs:sequence>
            <xs:element name="sourceSystem" type="cdt:string255">
                <xs:annotation>
                    <xs:documentation>
                        An entity id uniquely identifying the system providing
                        authentication or the system providing an additional
                        identifier for correlation - The value(s) to use should be
                        determined in consultation with the OCLC implementation
                        team.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="idAtSource" type="cdt:string2048" >
                <xs:annotation>
                    <xs:documentation>
                        The unique identifier for the user in the source system. See
                        the documentation for the element "correlationInfo".
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

