﻿<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsd:schema 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	xmlns="urn:cablelabs:iptvservices:esni:xsd:2" 
	targetNamespace="urn:cablelabs:iptvservices:esni:xsd:2" 
	elementFormDefault="qualified" attributeFormDefault="unqualified" version="1">
	<xsd:annotation>
		<xsd:documentation>
			<p>
				<b>Copyright (c)2013, Cable Television Laboratories, Inc.</b>
				<b>ESNI XML Schema, Release Version I02</b>
				<b>Event Scheduling and Notification Interface</b>
				<b>This schema is a normative component of CableLabs® Event 
					Scheduling and Notification Interface Specification,
					OC-SP-ESNI-I02-131001</b>
			</p>
		</xsd:documentation>
	</xsd:annotation>
	<xsd:element name="event" type="Event"/>
	<xsd:element name="vIRDs">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="vIRD" type="VIRD" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:simpleType name="EventType">
		<xsd:restriction base="xsd:token">
			<xsd:pattern value="ALT_CONTENT|private:.+"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="RestrictionType">
		<xsd:restriction base="xsd:token">
			<xsd:pattern value="VIRD|ZIP|ZIP4|MILEAGE|LATLONG|private:.+"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="AlternateAction">
		<xsd:restriction base="xsd:token">
			<xsd:enumeration value="CREATE"/>
			<xsd:enumeration value="GET"/>
			<xsd:enumeration value="UPDATE"/>
			<xsd:enumeration value="DELETE"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="AlternateContentType">
		<xsd:annotation>
			<xsd:documentation>FORCE_ALTERNATE = Force player to tune to alternate source; 
		FORCE_DESCRIPTION = Force player to display restriction.description field, 
		but stay on main source; USER_CHOICE = Allow player to choose from the list of alternate 
		sources in restrictions</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:token">
			<xsd:enumeration value="FORCE_ALTERNATE"/>
			<xsd:enumeration value="FORCE_DESCRIPTION"/>
			<xsd:enumeration value="USER_CHOICE"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="SourceType">
		<xsd:restriction base="xsd:token">
			<xsd:pattern value="TMS|EIDR|ROVI|private:.+"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:complexType name="Event">
		<xsd:sequence>
			<xsd:element name="providerId" type="xsd:token"/>
			<xsd:element name="primarySrc" type="Source"/>
			<xsd:element name="utcStartTime" type="xsd:dateTime"/>
			<xsd:element name="utcStopTime" type="xsd:dateTime"/>
			<xsd:element name="startSignalId" type="xsd:token" minOccurs="0"/>
			<xsd:element name="endSignalId" type="xsd:token" minOccurs="0"/>
			<xsd:element name="restriction" type="Restriction" maxOccurs="unbounded"/>
			<xsd:element name="ext" type="Ext" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="id" type="xsd:token" use="required"/>
		<xsd:attribute name="type" type="EventType" use="required"/>
		<xsd:attribute name="action" type="AlternateAction" use="required"/>
		<xsd:anyAttribute namespace="##other"/>
	</xsd:complexType>
	<xsd:complexType name="Restriction">
		<xsd:sequence>
			<xsd:element name="blacklist" type="xsd:boolean"/>
			<xsd:element name="altContentType" type="AlternateContentType"/>
			<xsd:element name="altSource" type="Source" minOccurs="0"/>
			<xsd:element name="description" type="xsd:string" minOccurs="0"/>
			<xsd:element name="confirmation" type="Confirmation" minOccurs="0"/>
			<xsd:element name="ext" type="Ext" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="id" type="xsd:token" use="required"/>
		<xsd:attribute name="type" type="RestrictionType" use="required"/>
		<xsd:anyAttribute namespace="##other"/>
	</xsd:complexType>
	<xsd:complexType name="Source">
		<xsd:simpleContent>
			<xsd:extension base="xsd:string">
				<xsd:attribute name="type" type="SourceType" use="required"/>
			</xsd:extension>
		</xsd:simpleContent>
	</xsd:complexType>
	<xsd:complexType name="VIRD">
		<xsd:sequence>
			<xsd:element name="location" type="Location" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="Confirmation">
		<xsd:sequence>
			<xsd:element name="ext" type="Ext" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="success" type="xsd:boolean" use="required">
			<xsd:annotation>
				<xsd:documentation>Indicator true if this restriction was correctly processed for this restriction</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="exception" type="xsd:string">
			<xsd:annotation>
				<xsd:documentation>Explanation for why a restriction might not have been processed as expected - provided if success is false</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="actualStart" type="xsd:dateTime">
			<xsd:annotation>
				<xsd:documentation>Actual time when this event restriction was initiated</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="actualEnd" type="xsd:dateTime">
			<xsd:annotation>
				<xsd:documentation>Actual time when this event restriction was terminated - if known</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:anyAttribute namespace="##other"/>
	</xsd:complexType>
	<xsd:complexType name="Ext">
		<xsd:complexContent>
			<xsd:extension base="xsd:anyType"/>
		</xsd:complexContent>
	</xsd:complexType>
	<xsd:complexType name="Location">
		<xsd:attribute name="id" type="xsd:token" use="required"/>
		<xsd:attribute name="type" type="RestrictionType" use="required"/>
	</xsd:complexType>
</xsd:schema>
