﻿<?xml version="1.0" encoding="utf-8"?>

<xs:schema attributeFormDefault="unqualified" 
           elementFormDefault="qualified" 
           xmlns:hav="http://www.HopAndVineHull.co.uk/Drinks" 
           targetNamespace="http://www.HopAndVineHull.co.uk/Drinks" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- Document Element -->
  <xs:element name="Drinks" type="hav:DrinksType"/>

  <!-- Complex Type Definitions -->
  <xs:complexType name="DrinksType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" ref="hav:Section"/>
    </xs:sequence>
    <xs:attribute name="ValidFrom" type="xs:string" use="required" />
  </xs:complexType>

  <xs:element name="Section">
    <xs:complexType>
      <xs:choice maxOccurs="unbounded">
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Spirit" type="hav:SpiritType"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Bottle" type="hav:BottleType"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Wine" type="hav:WineType"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Draught" type="hav:DraughtType"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="hav:Section"/>
      </xs:choice>
      <xs:attribute name="Name" type="xs:string" use="required" />
      <xs:attribute name="Heading" type="xs:string" use="optional" />
      <xs:attribute name="Icon" type="xs:string" use="optional" />
    </xs:complexType>
  </xs:element>

  <xs:complexType name="SpiritType">
    <xs:attribute name="Name" type="xs:string" use="required" />
    <xs:attribute name="Measure" type="hav:MeasureType" use="required" />
    <xs:attribute name="Single" type="xs:decimal" use="optional" />
    <xs:attribute name="Double" type="xs:decimal" use="optional" />
    <xs:attribute name="New" type="xs:boolean" use="optional" />
  </xs:complexType>

  <xs:complexType name="BottleType">
    <xs:attribute name="Maker" type="xs:string" use="optional" />
    <xs:attribute name="Name" type="xs:string" use="required" />
    <xs:attribute name="Size" type="xs:string" use="required" />
    <xs:attribute name="ABV" type="xs:decimal" use="optional" />
    <xs:attribute name="Price" type="xs:decimal" use="required" />
    <xs:attribute name="New" type="xs:boolean" use="optional" />
  </xs:complexType>

  <xs:complexType name="WineType">
    <xs:attribute name="Name" type="xs:string" use="required" />
    <xs:attribute name="Country" type="xs:string" use="required" />
    <xs:attribute name="Small" type="xs:decimal" use="required" />
    <xs:attribute name="Large" type="xs:decimal" use="required" />
    <xs:attribute name="Carafe" type="xs:decimal" use="optional" />
    <xs:attribute name="Bottle" type="xs:decimal" use="optional" />
    <xs:attribute name="Style" type="xs:string" use="optional" />
    <xs:attribute name="New" type="xs:boolean" use="optional" />
  </xs:complexType>

  <xs:complexType name="DraughtType">
    <xs:attribute name="Name" type="xs:string" use="required" />
    <xs:attribute name="ABV" type="xs:decimal" use="optional" />
    <xs:attribute name="Size" type="xs:string" use="optional" />
    <xs:attribute name="Price" type="xs:decimal" use="optional" />
    <xs:attribute name="Pint" type="xs:decimal" use="optional" />
    <xs:attribute name="Half" type="xs:decimal" use="optional" />
    <xs:attribute name="New" type="xs:boolean" use="optional" />
  </xs:complexType>

  <xs:simpleType name="MeasureType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="25ml"/>
      <xs:enumeration value="35ml"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>