<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.pegs-pegstour.com/API/XMLSchema/1.0.1" xmlns="http://www.pegs-pegstour.com/API/XMLSchema/1.0.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<xsd:simpleType name="t_Empty">
		<xsd:restriction base="xsd:string">
			<xsd:length value="0"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="t_Language">
		<xsd:restriction base="xsd:string"/>
	</xsd:simpleType>
	<xsd:simpleType name="t_PositiveInt">
		<xsd:restriction base="xsd:integer">
			<xsd:minInclusive value="1"/>
			<xsd:maxExclusive value="2147483647"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="t_UserName">
		<xsd:restriction base="xsd:string">
			<xsd:maxLength value="30"/>
			<xsd:minLength value="1"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="t_Password">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="8"/>
			<xsd:maxLength value="24"/>
		</xsd:restriction>
		<!--Must contain at least 1 non-alphabetic character (e.g. a number) and cannot contain the login name.-->
	</xsd:simpleType>
	<xsd:complexType name="t_Warning">
		<xsd:sequence>
			<xsd:element name="ID" type="xsd:long">
				<xsd:annotation>
					<xsd:documentation>The error ID uniquely identifies the error instance.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="Code" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>Code to indicate the class of this error.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="Description">
				<xsd:annotation>
					<xsd:documentation>Description of error condition</xsd:documentation>
				</xsd:annotation>
				<xsd:complexType>
					<xsd:simpleContent>
						<xsd:extension base="xsd:string">
							<xsd:attribute name="LanguageCode" type="t_Language" use="required"/>
						</xsd:extension>
					</xsd:simpleContent>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="Source" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>Source of error</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="t_Error">
		<xsd:complexContent>
			<xsd:extension base="t_Warning">
				<xsd:sequence>
					<xsd:element name="StackTrace" type="xsd:string" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>The StackTrace will be returned when an API Setting is on.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	<xsd:complexType name="t_Authentication">
		<xsd:sequence>
			<xsd:element name="Username" type="t_UserName"/>
			<xsd:element name="Password" type="t_Password"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="t_BaseResponse">
		<xsd:sequence>
			<xsd:element name="Warning" type="t_Warning" minOccurs="0" maxOccurs="unbounded">
				<xsd:annotation>
					<xsd:documentation>A warning or information about the booking process just performed may be returned with the  booking.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="Token">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="SessionToken">
					<xsd:simpleType>
						<xsd:restriction base="xsd:string">
							<xsd:maxLength value="4096"/>
							<xsd:minLength value="128"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
				<xsd:element name="MessageId" type="xsd:string" minOccurs="0"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="TokenResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="SequenceNumber" type="xsd:long" minOccurs="0"/>
				<xsd:element name="MessageId" type="xsd:string" minOccurs="0"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
  <xsd:element name="ErrorResponse">
    <xsd:annotation>
      <xsd:documentation>Describes any errors that occur during system operation.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
    	<xsd:sequence>
     		<xsd:element name="Error" type="t_Error" maxOccurs="unbounded"/>
     	</xsd:sequence>
 		</xsd:complexType>
  </xsd:element>
	<xsd:element name="LoginRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Expiry" default="4200" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>Defines the required timeout period of the session, in whole seconds. NOTE: The API session manager can choose to ignore/override this value.</xsd:documentation>
					</xsd:annotation>
					<xsd:simpleType>
						<xsd:restriction base="xsd:positiveInteger">
							<xsd:minInclusive value="4200"/>
							<xsd:maxInclusive value="7200"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
				<xsd:element name="Language" type="t_Language" default="en-GB" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>Defines the client prefered language. This language is used to report back errors and user messages.</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="Sequence" type="t_Empty" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>Defines whether a sequence number will be attached to each API  transactional response. An increasing sequence number is returned on each API response. The value can be monitored by the client to ensure that there are no intruders using the hijacked session. The client can then terminate the session to prevent abuse.</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="Lives" type="t_PositiveInt" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>Defines the maximum number of transactions that can occur on the session. The session is automatically disabled when this maximum number of   transactions has occured. This policy prevents abuse by intruders.</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="Authentication" type="t_Authentication"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="LoginResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Expiry">
					<xsd:simpleType>
						<xsd:restriction base="xsd:positiveInteger">
							<xsd:minInclusive value="4200"/>
							<xsd:maxInclusive value="7200"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
				<xsd:element name="SessionToken">
					<xsd:simpleType>
						<xsd:restriction base="xsd:string">
							<xsd:minLength value="128"/>
							<xsd:maxLength value="4096"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>

