<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : ping-actions.xsd
    Created on : April 22, 2003, 9:56 AM
    Author     : bsimons
    Description:
        Describes the ping action/result protocol
-->

<xsd:schema targetNamespace="http://ping.chip.org/schemas/ping-actions"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:doc="http://ping.chip.org/schemas/ping-document"
            xmlns:pid="http://ping.chip.org/schemas/pid"
            xmlns:pingr="http://ping.chip.org/schemas/ping-record"
            xmlns:cred="http://ping.chip.org/schemas/ping-credentials"
            xmlns:attr="http://ping.chip.org/schemas/ping-actor-attributes"
            xmlns:pingt="http://ping.chip.org/schemas/ping-talk"
            xmlns:pinga="http://ping.chip.org/schemas/ping-actions"
            xmlns="http://www.w3.org/2001/XMLSchema"
            xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
            xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
            jaxb:extensionBindingPrefixes="xjc"
            jaxb:version="1.0"
            elementFormDefault="unqualified">
    <import namespace="http://ping.chip.org/schemas/ping-talk" 
            schemaLocation="ping-talk.xsd"/>            
    <import namespace="http://ping.chip.org/schemas/ping-record" 
            schemaLocation="ping-record.xsd"/>
    <import namespace="http://ping.chip.org/schemas/ping-credentials" 
            schemaLocation="ping-credentials.xsd"/>
    <import namespace="http://ping.chip.org/schemas/ping-actor-attributes" 
            schemaLocation="ping-actor-attributes.xsd"/>
    <import namespace="http://ping.chip.org/schemas/pid" 
        schemaLocation="ping-schema-pid.xsd"/>
    <import namespace="http://ping.chip.org/schemas/ping-document" 
        schemaLocation="ping-document.xsd"/>
    
    <element name="CreateAction" type="pinga:CreateActionType" />
    <!--Action for creating a new record-->
    <complexType name="CreateActionType">
        <sequence>
            <!--The ID of the owner of the new record-->
            <element name="PingId" type="pid:AnyIdType" />
            <!--The record being created-->
            <element ref="pingr:PingRecord"/>
        </sequence>
    </complexType>
    
    <element name="ReadAction" type="pinga:ReadActionType" />
    <!--Action for reading an existin record-->
    <complexType name="ReadActionType">
        <sequence>
            <!--The ID of the owner of the record being read-->
            <element name="PingId" type="pid:AnyIdType" />
        </sequence>
    </complexType>
    
    <element name="QueryAction" type="pinga:QueryActionType" />
    <!--Action for querying for a list of records that match the specified 
        parameters-->
    <complexType name="QueryActionType">
        <sequence>
            <!--The parameters that describe the records to be included in the 
                list.  This action is currently limited to the parameter "*"
                which will result in a list of all records that the querying
                actor is authorized to read.-->
            <element name="Query" type="string"/>
        </sequence>
    </complexType>
    
    <element name="AddDocumentAction" type="pinga:AddDocumentActionType" />
    <!--Action for adding a document to an existing record-->
    <complexType name="AddDocumentActionType">
        <sequence>
            <!--The ID of the owner of the record that the document is being
                added to-->
            <element name="PingId" type="pid:AnyIdType" />
            <!--The document to be added-->
            <element ref="doc:PingDocument"/>
        </sequence>
    </complexType>
    
    <element name="UpdateDocumentAction" type="pinga:UpdateDocumentActionType" />
    <!--Action for updating an existing document within an existing record-->
    <complexType name="UpdateDocumentActionType">
        <sequence>
            <!--The ID of the owner of the record that the document is being
                updated in-->
            <element name="PingId" type="pid:AnyIdType" />
            <!--The classification of the document being updated-->
            <element name="DocumentClassification" type="string" />
            <!--The index of the document being updated-->
            <element name="DocumentIndex" type="string" />
            <!--The new version of the document-->
            <element ref="doc:PingDocument"/>
        </sequence>
    </complexType>
    
    <element name="ReadResult" type="pinga:ReadResultType" />
    <!--The result of the ReadAction-->
    <complexType name="ReadResultType">
        <sequence>
            <!--The record that was read-->
            <element ref="pingr:PingRecord" minOccurs="0"/>
        </sequence>
    </complexType>
    
    <element name="QueryResult" type="pinga:QueryResultType" />
    <!--The result of the QueryAction-->
    <complexType name="QueryResultType">
        <sequence>
            <!--A list of IDs of owners whose records match the query-->
            <element name="PingId" type="pid:AnyIdType" minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
    </complexType>
    
    <element name="CreateResult" type="pinga:CreateResultType" />
    <!--The result of the CreateAction-->
    <complexType name="CreateResultType">
        <sequence>
            <!--The newly created record-->
            <element ref="pingr:PingRecord" minOccurs="0"/>
        </sequence>
    </complexType>
    
    <element name="AddDocumentResult" type="pinga:AddDocumentResultType" />
    <!--The result of the AddDocumentAction-->
    <complexType name="AddDocumentResultType">
        <sequence>
            <!--The document that was added-->
            <element ref="doc:PingDocument" minOccurs="0"/>
        </sequence>
    </complexType>
    
    <element name="UpdateDocumentResult" type="pinga:UpdateDocumentResultType" />
    <!--The result of the UpdateAction-->
    <complexType name="UpdateDocumentResultType">
        <sequence>
            <!--The new version of the updated document-->
            <element ref="doc:PingDocument" minOccurs="0" />
        </sequence>
    </complexType>
</xsd:schema>