<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/GolfCountryClub" xmlns:tns="http://www.example.org/GolfCountryClub">

  <element name="GolfCountryClub">
    <complexType>
      <sequence>
        <element name="GolfCourse" type="tns:GolfCourseType" maxOccurs="unbounded" minOccurs="1"></element>
        <element name="Member" maxOccurs="unbounded" minOccurs="1">
          <complexType>
            <choice>
              <element name="RestrictedMember" type="tns:RestrictedMemberType"></element>
              <element name="RegularMember" type="tns:RegularMemberType"></element>
              <element name="ExclusiveMember" type="tns:ExclusiveMemberType">
                <annotation>
                  <documentation>Life-time member</documentation>
                </annotation>
              </element>
            </choice>
            <attribute name="handicap" type="nonNegativeInteger"></attribute>
          </complexType>
        </element>
        <element name="Employee" type="tns:EmployeeType" maxOccurs="unbounded" minOccurs="1"></element>
        <element name="ProShop">
          <complexType>
            <sequence>
              <element name="GolfClub" type="tns:GolfClubType" maxOccurs="unbounded" minOccurs="1"></element>
              <element name="BoxOfBalls" maxOccurs="unbounded" minOccurs="1" type="tns:BoxOfBallsType"></element>
            </sequence>
          </complexType>
        </element>
      </sequence>
    </complexType>
  </element>

  <complexType name="RegularMemberType">
    <complexContent>
      <extension base="tns:PersonType">
        <sequence>
          <element name="MembershipExpiry" type="date"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="GolfClubType">
    <complexContent>

      <extension base="tns:GolfManufacturerType">
        <sequence>
          <element name="ClubKind" type="tns:ClubKindType"></element>
          <element name="Loft" type="string"></element>
          <element name="Shaft" type="tns:ShaftType"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <simpleType name="ClubKindType">
    <restriction base="string">
      <enumeration value="Driver"></enumeration>
      <enumeration value="Wood"></enumeration>
      <enumeration value="Iron"></enumeration>
      <enumeration value="Wedge"></enumeration>
      <enumeration value="Putter"></enumeration>
    </restriction>
  </simpleType>

  <simpleType name="ShaftType">
    <restriction base="string">
      <enumeration value="Regular"></enumeration>
      <enumeration value="Stiff"></enumeration>
    </restriction>
  </simpleType>

  <element name="GolfClub" type="tns:GolfClubType"></element>

  <complexType name="PersonType">
    <sequence>
      <element name="FirstName" type="string"></element>
      <element name="MiddleName" type="string" maxOccurs="1" minOccurs="0"></element>
      <element name="LastName" type="string"></element>
    </sequence>
  </complexType>

  <complexType name="EmployeeType">
    <complexContent>
      <extension base="tns:PersonType">
        <sequence>
          <element name="EmployeeNumber" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="GolfCourseType">
    <sequence>
      <element name="Name" type="string">
        <annotation>
          <documentation>Name of the course</documentation>
        </annotation>
      </element>
      <element name="Yardage" type="positiveInteger"></element>
      <element name="Par" type="positiveInteger"></element>
      <element name="Handicap">
        <simpleType>
          <restriction base="float">
            <minInclusive value="0"></minInclusive>
          </restriction>
        </simpleType>
      </element>
      <element name="Slope" type="string"></element>
    </sequence>
    <attribute name="NumberOfHoles" type="positiveInteger" fixed="18"></attribute>
  </complexType>

  <complexType name="GolfManufacturerType">
    <sequence>
      <element name="ManufacturerName" type="string"></element>
      <element name="Quantity" type="positiveInteger"></element>
    </sequence>
  </complexType>

  <complexType name="BoxOfBallsType">
    <complexContent>
      <extension base="tns:GolfManufacturerType">
        <sequence>
          <element name="ProductDetails" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="ExclusiveMemberType">
    <complexContent>
      <extension base="tns:PersonType">
        <sequence>
          <element name="ValetParkingID" type="positiveInteger"></element>
          <element name="LockerNumber" type="positiveInteger"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="RestrictedMemberType">
    <complexContent>
      <extension base="tns:PersonType">
        <sequence>
          <element name="MembershipExpiry" type="date"></element>
          <element name="LimitedPlay" type="tns:LimitedPlayType"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <simpleType name="LimitedPlayType">
    <restriction base="string">
      <enumeration value="Weekday Only"></enumeration>
      <enumeration value="Weekend Only"></enumeration>
      <enumeration value="Anytime after twilight"></enumeration>
    </restriction>
  </simpleType>
</schema>
