<?xml version = "1.0"?>

<!-- 
   
  XML Schema declaration for AGLS Agent Syntax Encoding Scheme.
  
  Initial Release
  Date:     2003-09
  Creator:  Duncan Jamieson, National Archives of Australia

  This Version
  Created:  2007-12-12
  Modified: 2008-01-22
  Creator:  David Bromage, National Archives of Australia
  
 -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="http://www.agls.gov.au/agls/terms/AglsAgent"
           targetNamespace="http://www.agls.gov.au/agls/terms/"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified">

<xs:annotation>
  <xs:documentation xml:lang="en-AU">
    This document defines the AGLS Agent Syntax Encoding Scheme, which is used in
    the schema definition for AGLS metadata.

    Copyright Commonwealth of Australia 2003
  </xs:documentation>
</xs:annotation>

<!-- Include references to externally defined types used by this schema.
They are defined externally to ensure that any new types can be added 
without changing the core essence of this schema -->

<xs:import namespace="http://www.agls.gov.au/agls/terms/"
           schemaLocation="AglsJuri.xsd"/>

<xs:complexType name="AglsAgent">
  <xs:sequence>

    <xs:element name="personalName" minOccurs="0">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">The name of a person</xs:documentation>
      </xs:annotation>
    </xs:element>

    <xs:element name="corporateName" type="xs:string" minOccurs="0" maxOccurs="unbounded">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">The name of an organisation</xs:documentation>
      </xs:annotation>
    </xs:element>

    <xs:element name="jurisdiction" type="AglsJuri" minOccurs="0" maxOccurs="unbounded">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">The legal jurisdiction of the agent</xs:documentation>
      </xs:annotation>
    </xs:element>

    <xs:element name="contact" type="xs:string" minOccurs="0" maxOccurs="unbounded">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">Contact details for the agent. Can include an official title. Typically includes a phone number.</xs:documentation>
      </xs:annotation>
    </xs:element>

    <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="unbounded">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">Street or postal address for the agent.</xs:documentation>
      </xs:annotation>
    </xs:element>

    <xs:element name="email" minOccurs="0" maxOccurs="unbounded">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">Email address for the agent</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:pattern value="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$ "/>
        </xs:restriction>
      </xs:simpleType>
    </xs:element>

    <xs:element name="hours" minOccurs="0" maxOccurs="unbounded">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">Hours during which the resource can be accessed at the locations identified in the address component </xs:documentation>
      </xs:annotation>
    </xs:element>

    <xs:element name="postcode" type="xs:string" minOccurs="0" maxOccurs="unbounded">
      <xs:annotation>
        <xs:documentation xml:lang="en-AU">Australian postcodes for the agent.</xs:documentation>
      </xs:annotation>
    </xs:element>

  </xs:sequence>
</xs:complexType>
  
</xs:schema>
