<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:defra.gov.uk:ESP:SeedCerts" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SeedCerts="urn:defra.gov.uk:ESP:SeedCerts" xmlns:gt="http://www.govtalk.gov.uk/Schemas/govtalk/core" elementFormDefault="qualified" attributeFormDefault="unqualified" version="8.2" id="DEFRA_SeedCert_Cert3Summ">
	<xs:annotation>
		<xs:documentation>This schema is used for submitting Seed Cert forms through the Gateway to Defra and NIAB</xs:documentation>
		<xs:appinfo>Defra, Seed Certification, Cert3Summ, NIAB</xs:appinfo>
	</xs:annotation>
	<xs:include schemaLocation="SC_Common.xsd"/>
	<xs:element name="Cert3Summ" type="SeedCerts:Cert3SummType">
		<xs:annotation>
			<xs:documentation>Root element for Cert3Summ</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:complexType name="Cert3SummType">
		<xs:sequence>
			<xs:element name="MessageCreationTimestamp" type="xs:dateTime" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Cert3SummDetails" type="SeedCerts:Cert3SummStructure" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Structure containing details for Cert3Summ applications</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<!-- Start of Cert3SummStructure type definition -->
	<xs:complexType name="Cert3SummStructure">
		<xs:sequence>
			<!-- Action element is for internal use, do not populate for uploaded applications -->
			<xs:element name="Action" type="SeedCerts:ActionType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ApplicationID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ApplicantOfficialNumber" type="SeedCerts:OfficialNumberType">
				<xs:annotation>
					<xs:documentation>Unique number assigned to applicant by Defra</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="SpeciesName" type="SeedCerts:LongStringType">
				<xs:annotation>
					<xs:documentation>Species name</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Cert3SummLine" type="SeedCerts:Cert3SummLineStructure" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Structure containing crop line details</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<!-- End of Cert3SummStructure type definition -->
	<!-- ==================== -->
	<!-- Common Complex Types -->
	<!-- ==================== -->
	<!-- Start of Cert3SummLineStructure definition -->
	<xs:complexType name="Cert3SummLineStructure">
		<xs:sequence>
			<xs:element name="ApplicationID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ApplicationLineID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CropIdentityNo" type="SeedCerts:CropIdentityNoType">
				<xs:annotation>
					<xs:documentation>Crop identity number</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="AreaPassed" type="SeedCerts:AreaType">
				<xs:annotation>
					<xs:documentation>Area passed inspection (ha)</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="AreaRejected" type="SeedCerts:AreaType">
				<xs:annotation>
					<xs:documentation>Area inspection rejected (ha)</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CategoryLevel" type="SeedCerts:CategoryType">
				<xs:annotation>
					<xs:documentation>Category for species and variety combination</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="VarietyDetails" type="SeedCerts:VarietyStructure">
				<xs:annotation>
					<xs:documentation>Structure containing variety details</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CropResults" type="SeedCerts:CropResultStructure" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Structure containing crop inspection results</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="InspectionDetails" type="SeedCerts:InspectionDetailsStructure" maxOccurs="9">
				<xs:annotation>
					<xs:documentation>Structure containing crop inspector details</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="RowNo" type="xs:positiveInteger" use="optional">
			<xs:annotation>
				<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<!-- End of Cert3SummLineStructure definition -->
	<!-- Start of InspectionDetailsStructure definition -->
	<xs:complexType name="InspectionDetailsStructure">
		<xs:annotation>
			<xs:documentation>Structure containing crop inspector details</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="ApplicationID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ApplicationLineID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="InspectionNumber" type="SeedCerts:InspectionNumberType">
				<xs:annotation>
					<xs:documentation>Inspection number</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="LicenceNumber" type="SeedCerts:LicenceNumberStructure" maxOccurs="9">
				<xs:annotation>
					<xs:documentation>Structure containing crop inspector licence details</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<!-- End of InspectionDetailsStructure definition -->
	<xs:simpleType name="InspectionNumberType">
		<xs:restriction base="xs:positiveInteger">
			<xs:minInclusive value="1"/>
			<xs:maxInclusive value="5"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="LicenceNumberStructure">
		<xs:sequence>
			<xs:element name="ApplicationID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ApplicationLineID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="InspectionNumber" type="SeedCerts:InspectionNumberType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>Inspection number</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Licence" type="SeedCerts:LicenceNumberType">
				<xs:annotation>
					<xs:documentation>Crop inspector licence number</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="CropResultStructure">
		<xs:annotation>
			<xs:documentation>Structure containing crop inspection results</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="ApplicationID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ApplicationLineID" type="SeedCerts:ProgramIDType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>For internal use only - should not be populated by external applications</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CategoryLevel" type="SeedCerts:CategoryType">
				<xs:annotation>
					<xs:documentation>Inspection category. All categories at which a crop is approved should be set to Y - it will be assumed
						that a category not set means that the crop was not approved at that particular category</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CropResult" type="SeedCerts:CropResultType">
				<xs:annotation>
					<xs:documentation>Crop result for inspection category. AreaPassed must be greater than 0 if any results are Y.
						AreaPassed must equal 0 if all results are N.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:schema>
