<xsd:schema targetNamespace="http://convio.com/crm/v1.0"
    xmlns:crm="http://convio.com/crm/v1.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">

    <xsd:annotation>
        <xsd:documentation xml:lang="en">
            Convio API Version 1.0.
            All Rights Reserved.
        </xsd:documentation>
    </xsd:annotation>

    <xsd:include schemaLocation="crm.public.constituent.v1.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Include types for constituent methods.
            </xsd:documentation>
        </xsd:annotation></xsd:include>

    <xsd:include schemaLocation="crm.public.donation.v1.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Include types for donations methods.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:include>

    <xsd:include schemaLocation="crm.public.teamraiser.v1.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Include types for teamraiser methods.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:include>
    
    <xsd:include schemaLocation="crm.public.orgevent.v1.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Include types for calendar event methods.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:include>

    <!-- ============================== -->
    <!-- Common API Responses           -->
    <!-- ============================== -->

    <xsd:element name="errorResponse"                type="crm:errorResponse" />

    <xsd:element name="getLoginUrlResponse" type="crm:loginUrlResult" />
    <xsd:element name="loginResponse" type="crm:singleSignOnTokenResult" />
    <xsd:element name="getSingleSignOnTokenResponse" type="crm:singleSignOnTokenResult" />
    <xsd:element name="singleSignOnMethodResponse"   type="xsd:token" />

    <xsd:complexType name="singleSignOnTokenResult">
        <xsd:annotation>
            <xsd:documentation>
                The response returned for getSingleSignOnToken and login requests.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:all>
            <xsd:element name="token" type="xsd:token" />
            <xsd:element name="cons_id" type="crm:constituentID" />
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="loginUrlResult">
        <xsd:annotation>
            <xsd:documentation>
                The response returned for getLoginUrl requests.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:all>
            <xsd:element name="url" type="xsd:normalizedString" />            
            <xsd:element name="token" type="xsd:token" />
        </xsd:all>
    </xsd:complexType>
    
    <!-- ============================== -->
    <!-- Constituent API Responses      -->
    <!-- ============================== -->

    <xsd:element name="listConsFieldsResponse">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="field" type="crm:consFieldDescription"
                             minOccurs="0" maxOccurs="unbounded" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="listConsFieldChoicesResponse">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="choice" type="xsd:normalizedString"
                             minOccurs="0" maxOccurs="unbounded" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="createConsResponse"         type="crm:constituentIdAndMessage"/>
    <xsd:element name="updateConsResponse"         type="crm:constituentIdAndMessage"/>
    <xsd:element name="createOrUpdateConsResponse" type="crm:constituentIdAndMessage"/>
    <xsd:element name="getConsResponse"            type="crm:constituentRecord"/>

    <xsd:element name="getConsInterestsResponse">
        <xsd:annotation>
            <xsd:documentation>
                The response to the "getUserInterests" method.
                It is a list of interest categories for which the constituent
                has expressed an interest, or "opt'ed in".
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="interest" type="crm:interestSummary"
                             minOccurs="0" maxOccurs="unbounded" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="isConsInterestedResponse" type="crm:isConsInterestedResult" />

    <xsd:element name="getInterestMembersResponse">
        <xsd:annotation>
            <xsd:documentation>
                The response to the "getInterestMembers" method.
                It is a list of constituents interested in a given interest
                category.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="total_number"    type="crm:nonNegInteger" />
                <xsd:element name="number_returned" type="crm:nonNegInteger" />
                <xsd:element name="member"          type="crm:constituentRecord"
                             minOccurs="0" maxOccurs="unbounded" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="getConsGroupsResponse">
        <xsd:annotation>
            <xsd:documentation>
                The response to the "getUserGroups" method.
                It is a list of groups to which the constituent belongs.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="group" type="crm:groupSummary"
                             minOccurs="0" maxOccurs="unbounded" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="getGroupMembersResponse">
        <xsd:annotation>
            <xsd:documentation>
                The response to the "getGroupMembers" method.
                It is a list of constituents belonging to a given group.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="total_number"    type="crm:nonNegInteger" />
                <xsd:element name="number_returned" type="crm:nonNegInteger" />
                <xsd:element name="member"          type="crm:constituentRecord"
                             minOccurs="0" maxOccurs="unbounded" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <!-- ============================== -->
    <!-- Donations API Responses        -->
    <!-- ============================== -->

    <xsd:element name="donationResponse" type="crm:donationResult"/>

    <!-- ============================== -->
    <!-- Teamraiser API Responses        -->
    <!-- ============================== -->

    <xsd:element name="getRegistrationResponse"       type="crm:getRegistrationResult" />
    <xsd:element name="getFlowStepResponse"           type="crm:getFlowStepResult" />
    <xsd:element name="getFundraisingResponse"        type="crm:getFundraisingResult" />
    <xsd:element name="updateRegistrationResponse"    type="crm:updateRegistrationResult" />
    <xsd:element name="getSurveyResponsesResponse"    type="crm:getSurveyResponsesResult" />
    <xsd:element name="updateSurveyResponsesResponse" type="crm:updateSurveyResponsesResult" />
    <xsd:element name="getEventDataParameterResponse" type="crm:getEventDataParameterResult" />
    <xsd:element name="getUpsellResponse"             type="crm:getUpsellResult" />
    <xsd:element name="getParticipationTypeResponse"  type="crm:getParticipationTypeResult" />
    <xsd:element name="getTeamResponse"               type="crm:getTeamResult" />
    <xsd:element name="getRegisteredTeamraisersResponse" type="crm:getRegisteredTeamraisersResult" />
    <xsd:element name="getDonorList" 	              type="crm:getDonorListResult" />
    
    <!-- ============================== -->
    <!-- OrgEvent API Responses        -->
    <!-- ============================== -->

    <xsd:element name="getEventResponse"       type="crm:getEventResult" />
    <xsd:element name="getDayEventsResponse" type="crm:getDayEventsResult" />
    <xsd:element name="getMonthEventsResponse" type="crm:getMonthEventsResult" />
    <xsd:element name="getChildEventsResponse" type="crm:getChildEventsResult" />

    <!-- ================================== -->
    <!-- Error Response Types               -->
    <!-- ================================== -->

    <xsd:complexType name="errorResponse">
        <xsd:annotation>
            <xsd:documentation>
                The response returned when any method call results in an error
                condition.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:all>
            <xsd:element name="message" type="xsd:string" />
            <xsd:element name="code"    type="crm:errorCode" />
        </xsd:all>
    </xsd:complexType>

    <xsd:simpleType name="errorCode">
        <xsd:annotation>
            <xsd:documentation>
                A numeric value indicating a type of error. See API
                documentation to determine the meaning or possible causes for
                each type.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:positiveInteger">
            <xsd:totalDigits value="6"/>
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>
