<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="nes.cex.sp.ml.nagra.com" targetNamespace="nes.cex.sp.ml.nagra.com" elementFormDefault="qualified">
	<xs:complexType name="BaseResourceType">
		<xs:annotation>
			<xs:documentation>This element defines common attributes of all root elements</xs:documentation>
		</xs:annotation>
		<xs:attribute name="providerId" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>id of the content provider</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="providerResourceId" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>id of the resource for this specific content provider</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="id" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Public id unique across all content provider ids</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:complexType name="BaseResourceTypeWithMetadata">
		<xs:annotation>
			<xs:documentation>This element defines common attributes of all root elements</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="BaseResourceType">
				<xs:sequence>
					<xs:element name="metadataSet" type="MetadataSetType" minOccurs="0" maxOccurs="unbounded">
						<xs:annotation>
							<xs:documentation>This element defines a specific set of metadata for a specific locale.
Only one MetadataSet per locale is allowed.</xs:documentation>
						</xs:annotation>
					</xs:element>
				</xs:sequence>
				<xs:attribute name="name" type="xs:string" use="required">
					<xs:annotation>
						<xs:documentation>Working name of the resource (used usually to identify a resource in the operator User Interface)</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="MetadataType">
		<xs:annotation>
			<xs:documentation>Metadata value</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="key" type="xs:string" use="required">
					<xs:annotation>
						<xs:documentation>Metadata key.
it must be unique for a specific resource and for a specific locale.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="MetadataSetType">
		<xs:sequence>
			<xs:element name="metadata" type="MetadataType" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Metadata editorial or not of the metadata owner. The different metadata allowed and their definition must be defined outside of the scheme</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="locale" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Language-country code in which the metadata set is written.
It must be conformed to ISO-639 and ISO 3166-1.
If the MetadataSet is not localised, the locale must be set to "none".</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:complexType name="MetadataSetNoLocaleType">
		<xs:annotation>
			<xs:documentation>The Metadata Set Type which defines a specific set of metadata for the locale "none"</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:restriction base="MetadataSetType">
				<xs:sequence>
					<xs:element name="metadata" type="MetadataType" minOccurs="0" maxOccurs="unbounded">
						<xs:annotation>
							<xs:documentation>A metadata.</xs:documentation>
						</xs:annotation>
					</xs:element>
				</xs:sequence>
				<xs:attribute name="locale" type="xs:string" use="required" fixed="none">
					<xs:annotation>
						<xs:documentation>locale will be set to "none" as it is not localised</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
    <xs:complexType name="SecurityInfoType">
      <xs:annotation>
        <xs:documentation>type describing a set of data related to a security device (CAS, DRM)</xs:documentation>
      </xs:annotation>
      <xs:sequence>
        <xs:element name="metadataSet" type="MetadataSetNoLocaleType" minOccurs="0">
          <xs:annotation>
            <xs:documentation>The Metadata Set Type which defines a specific set of metadata for the locale "none"</xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" use="optional">
        <xs:annotation>
          <xs:documentation>Drm or Cas id of the element for the specified security device (Drm or Cas). 
  This Drm/Cas id is only valid in the context of the Drm/Cas device specified</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="securityDeviceId" use="required">
        <xs:annotation>
          <xs:documentation>Id of the security device (Cas or Drm) assigned to the content.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
    
    <xs:complexType name="ParentalRatingSetType">
      <xs:annotation>
        <xs:documentation>Set of Parental rating is used to decide suitability for certain audiences based on its content</xs:documentation>
      </xs:annotation>
      <xs:sequence>
        <xs:element name="parentalRating" type="ParentalRatingType" minOccurs="0" maxOccurs="unbounded">
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  
    <xs:complexType name="ParentalRatingType">
    <xs:annotation>
      <xs:documentation>Parental rating is used to decide suitability for certain audiences based on its content</xs:documentation>
    </xs:annotation>
      <xs:attribute name="ratingBodyName" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation>The friendly name of the ratings body. This is unique across all ratings bodies in the system</xs:documentation>
        </xs:annotation>        
      </xs:attribute>
      <xs:attribute name="contentRatingCode" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation>The content rating code. This is unique across all content ratings in the system</xs:documentation>
        </xs:annotation>        
      </xs:attribute>
       <xs:attribute name="countryCode" type="TwoCharString"  use="required">
        <xs:annotation>
          <xs:documentation>The country code.</xs:documentation>
        </xs:annotation>        
      </xs:attribute>
  </xs:complexType>
  
  <xs:simpleType name="TwoCharString">
    <xs:annotation>
      <xs:documentation>2-char strings only</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:length value="2"/>
    </xs:restriction>
  </xs:simpleType>
  
	<xs:complexType name="PeriodType">
		<xs:annotation>
			<xs:documentation>Defines a period of time with a start date and an end date.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="start" type="gmtdatetime">
			<xs:annotation>
				<xs:documentation>Start date of the parent resource. 
A ISO 8601 compatible gmt datetime up to the second: yyyy-mm-ddThh:mm:ssZ.
If not available, any query condition against start will be true</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="end" type="gmtdatetime">
			<xs:annotation>
				<xs:documentation>End date of the parent resource. 
A ISO 8601 compatible gmt datetime up to the second: yyyy-mm-ddThh:mm:ssZ.
If not available, any query condition against end will be true.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:simpleType name="gmtdatetime">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9]Z"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
