<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="AccountJournal">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="AccountJournalInfo" minOccurs="1" maxOccurs="unbounded">
					<xs:annotation>
						<xs:documentation>Contains events affecting an account.</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:sequence>
							<xs:element name="CustomerNo" type="Identifier15" minOccurs="1" maxOccurs="1" nillable="false">
								<xs:annotation>
									<xs:documentation>CustomerNo is your unique identifier of the customer in the accounts receivable.</xs:documentation>
								</xs:annotation>
							</xs:element>
							<xs:element name="RegNo" type="RegNo" minOccurs="0" maxOccurs="1">
								<xs:annotation>
									<xs:documentation>If exists, Customer social security number/corporate identity number in the accounts receivable.</xs:documentation>
								</xs:annotation>
							</xs:element>
							<xs:element name="AccountNo" type="Identifier15" minOccurs="1" maxOccurs="1" nillable="false" >
								<xs:annotation>
									<xs:documentation>Unique accountnumber associated with the account in the accounts receivable.</xs:documentation>
								</xs:annotation>
							</xs:element>
							<xs:element name="AccountProfileName" type="String50" minOccurs="1" maxOccurs="1" nillable="false" >
								<xs:annotation>
									<xs:documentation>Profilename associated with the account</xs:documentation>
								</xs:annotation>
							</xs:element>
							<xs:element name="AccountStatusEvents" minOccurs="0" maxOccurs="1">
								<xs:annotation>
									<xs:documentation>Containing status events on an account.</xs:documentation>
								</xs:annotation>
								<xs:complexType>
									<xs:sequence>
										<xs:element name="AccountStatusEvent" type="AccountStatusEvent" minOccurs="1" maxOccurs="unbounded">
											<xs:annotation>
												<xs:documentation>Contains an account status event.</xs:documentation>
											</xs:annotation>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element name="AccountClaimEvents" minOccurs="0" maxOccurs="1">
								<xs:annotation>
									<xs:documentation>Containing claim events on an account.</xs:documentation>
								</xs:annotation>
								<xs:complexType>
									<xs:sequence>
										<xs:element name="AccountClaimEvent" type="AccountClaimEvent" minOccurs="1" maxOccurs="unbounded">
											<xs:annotation>
												<xs:documentation>Contains an account claim event.</xs:documentation>
											</xs:annotation>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute name="Version" type="Version" use="required" >
				<xs:annotation>
					<xs:documentation>The version of the schema-file (XSD) to be used for validation of the xml-file.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="CreatedDateTime" type="xs:dateTime" use="required">
				<xs:annotation>
					<xs:documentation>The date and time when the file was created.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="CompanyNo" type="CompanyNumber" use="required" >
				<xs:annotation>
					<xs:documentation>Your accounts receivable number at PayEx.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="CompanyName" type="xs:string" use="required" >
				<xs:annotation>
					<xs:documentation>The name of your company/accounts recievable at PayEx.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="Identifier15">
		<xs:restriction base="xs:string">
			<xs:pattern value="[a-zA-Z0-9äåöÄÅÖ&amp;/_ -.]*" />
			<xs:minLength value="1" />
			<xs:maxLength value="15" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="ISO3166">
		<xs:restriction base="xs:string">
			<xs:pattern value="[A-Z]*" />
			<xs:minLength value="2" />
			<xs:maxLength value="2" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="CompanyNumber">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]*" />
			<xs:minLength value="1" />
			<xs:maxLength value="15" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="String15">
		<xs:restriction base="xs:string">
			<xs:maxLength value="15" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="String50">
		<xs:restriction base="xs:string">
			<xs:maxLength value="50" />
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="AccountStatusEvent">
		<xs:sequence>
			<xs:element type="AccountStatusType" name="AccountStatusType" minOccurs="1" maxOccurs="1" nillable="false">
				<xs:annotation>
					<xs:documentation>The type of status that has been affected by the event/change.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="AccountStatusEventDate" type="xs:date" minOccurs="1" maxOccurs="1" nillable="false">
				<xs:annotation>
					<xs:documentation>The date when the event occurred</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Status" type="AccountStatus" maxOccurs="1" minOccurs="1" nillable="false">
				<xs:annotation>
					<xs:documentation>The state of the accountstatus due to the event</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="AccountClaimEvent">
		<xs:sequence>
			<xs:element name="ClaimEvent" type="eClaimEvent" minOccurs="1" maxOccurs="1" nillable="false">
				<xs:annotation>
					<xs:documentation>Type of claim event from enumeration.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ClaimEventDate" type="xs:date" minOccurs="1" maxOccurs="1" nillable="false">
				<xs:annotation>
					<xs:documentation>The date when the event occurred.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Amount" type="Amount" maxOccurs="1" minOccurs="0" nillable="false">
				<xs:annotation>
					<xs:documentation>Claim amount associated with the claimevent. Will not be set if ClaimEvent is ClaimProcessReset</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:simpleType name="AccountStatusType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="Created" >
				<xs:annotation>
					<xs:documentation>The account has been created.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="Terminated" >
				<xs:annotation>
					<xs:documentation>The account has been terminated.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="AccountStatus">
		<xs:restriction base="xs:string">
			<xs:enumeration value="Active">
				<xs:annotation>
					<xs:documentation>The status has been activated on the account.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="Cancelled">
				<xs:annotation>
					<xs:documentation>The status has been deactivted on the account.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="RegNo">
		<xs:annotation>
			<xs:documentation>Social security number/Corporate identity number conforming to country standard.</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="String15">
				<xs:attribute name="CountryCode" type="ISO3166" use="required">
					<xs:annotation>
						<xs:documentation>Nationality of RegNo according to ISO3166.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:simpleType name="eClaimEvent">
		<xs:restriction base="xs:string">
			<xs:enumeration value="ReminderSent">
				<xs:annotation>
					<xs:documentation>A reminder has been sent to the customer.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="SecondReminderSent">
				<xs:annotation>
					<xs:documentation>A second reminder has been sent to the customer.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="TerminationNoticeSent">
				<xs:annotation>
					<xs:documentation>A termination notice has been sent to the customer.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="CollectionClaimSent">
				<xs:annotation>
					<xs:documentation>A collection claim has been sent to the customer.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="DebtCollection">
				<xs:annotation>
					<xs:documentation>The claim has been transferred to collection.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="ClaimProcessReset">
				<xs:annotation>
					<xs:documentation>The bill is closed and the claim process has been reset.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="Amount">
		<xs:sequence>
			<xs:element name="AmountInclVat" type="Money" minOccurs="1" maxOccurs="1" nillable="false"/>
		</xs:sequence>
		<xs:attribute name="Currency" type="eCurrencyType" use="required" />
	</xs:complexType>
	<xs:simpleType name="eCurrencyType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="SEK" />
			<xs:enumeration value="NOK" />
			<xs:enumeration value="DKK" />
			<xs:enumeration value="EUR" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Money">
		<xs:restriction base="xs:decimal">
			<xs:fractionDigits value="2" />
			<xs:minInclusive value="-100000000" />
			<xs:maxInclusive value="100000000" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Version">
		<xs:annotation>
			<xs:documentation>Versions supported by this schema</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="1.0">
			</xs:enumeration>
			<xs:enumeration value="1.1">
				<xs:annotation>
					<xs:documentation>eClaimEvent ClaimProcessReset added. AccountClaimEvent.Amount changed to optional, ClaimProcessReset-event does not support this value</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
