<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:cablelabs:md:xsd:terms:3.0"
	xmlns:core="urn:cablelabs:md:xsd:core:3.0" targetNamespace="urn:cablelabs:md:xsd:terms:3.0"
	elementFormDefault="qualified" attributeFormDefault="unqualified" version="1">
	<xsd:import namespace="urn:cablelabs:md:xsd:core:3.0" schemaLocation="MD-SP-CORE-C01.xsd"/>
	<!--  ECN 14.xxx - Added DRMRestrictionsType -->
	<xsd:complexType name="DRMRestrictionsType">
		<xsd:annotation>
			<xsd:documentation>Digital Rights Management</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="DRMRestriction" maxOccurs="unbounded">
				<xsd:annotation>
					<xsd:documentation>Describes what drm/ca systems assocated with the Terms.</xsd:documentation>
				</xsd:annotation>
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element name="Ext" type="core:ExtType" minOccurs="0"/>
					</xsd:sequence>
					<xsd:attribute name="restrictionType" type="core:NonEmptyStringType">
						<xsd:annotation>
							<xsd:documentation>playReady, access, CA</xsd:documentation>
						</xsd:annotation>
					</xsd:attribute>
					<xsd:anyAttribute namespace="##any" processContents="lax">
						<xsd:annotation>
							<xsd:documentation>In addition to the attributes defined, an asset may include additional, custom attributes as needed by the application.</xsd:documentation>
						</xsd:annotation>
					</xsd:anyAttribute>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="Ext" type="core:ExtType" minOccurs="0"/>
		</xsd:sequence>
		<xsd:anyAttribute namespace="##any" processContents="lax">
			<xsd:annotation>
				<xsd:documentation>In addition to the attributes defined, an asset may include additional, custom attributes as needed by the application.</xsd:documentation>
			</xsd:annotation>
		</xsd:anyAttribute>
	</xsd:complexType>
	<xsd:complexType name="SubscriberViewLimitType">
		<xsd:complexContent>
			<xsd:extension base="core:DateTimeRangeType">
				<xsd:attribute name="maximumViews" type="xsd:unsignedInt" use="required"/>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	<xsd:complexType name="RoyaltyInfoType">
		<xsd:sequence>
			<xsd:element name="OrganizationName" type="core:OrganizationNameType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>The name of the distributor/studio.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="OrganizationCode" type="core:OrganizationCodeType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>The code for the distributor/studio.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="RoyaltyPercent" type="core:PercentType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Percentage split of the royalty over the minimum that goes to the distributor/studio.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="RoyaltyMinimum" type="core:PriceType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Minumum royalty in currency that goes to the distributor/studio.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="RoyaltyFlatRate" type="core:PriceType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Flat rate royalty in currency that goes to the distributor/studio.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="Ext" type="core:ExtType" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="TermsType">
		<xsd:complexContent>
			<xsd:extension base="core:AssetType">
				<xsd:sequence>
					<xsd:element name="ContractName" type="core:NonEmptyStringType" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>Name of the contract under which all titles associated with these terms are licensed.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="BillingGracePeriod" type="xsd:duration" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>Free preview period.  How long the customer can watch the content at no charge (called PreviewPeriod in ADI 1.1).</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="UsagePeriod" type="xsd:duration" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>The maximum duration of time the offer can be made available for viewing once selected for purchase by a customer (called Maximum_Viewing_Length in ADI 1.1). This only defines the maximum period, which may be altered by other windows - actual periods will be determined by the delivery system and business rules.  This element MUST be explicitly provided if the terms originated as V3.0.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="OfflineViewingPeriod" type="xsd:duration" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>Allowed offline viewing duration. (ex. P3D for 3 days)</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="HomeVideoWindow" type="xsd:duration" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>Number of days between home video release and PPV/MOD release.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="SubscriberViewLimit" type="SubscriberViewLimitType" minOccurs="0" maxOccurs="unbounded">
						<xsd:annotation>
							<xsd:documentation>The range of time and the maximum number of views over that period of time.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="SuggestedPrice" type="core:PriceType" minOccurs="0" maxOccurs="unbounded">
						<xsd:annotation>
							<xsd:documentation>Suggested price to assist in determining the retail pricing.  Multiple values are provided for expressing more than one currency.  The default currency is assumed to be dollars.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<!--  ECN14.0094 add WholesalePrice element -->
					<xsd:element name="WholesalePrice" type="core:PriceType" minOccurs="0"
						maxOccurs="unbounded">
						<xsd:annotation>
							<xsd:documentation>Wholesale price. Multiple values are provided for expressing more than one currency.  The default currency is assumed to be dollars.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="DistributorRoyaltyInfo" type="RoyaltyInfoType" minOccurs="0"/>
					<xsd:element name="StudioRoyaltyInfo" type="RoyaltyInfoType" minOccurs="0"/>
					<xsd:element name="IsResumeEnabled" type="xsd:boolean" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>Indication that viewing can be resumed at a later time.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="TrickModesRestricted" type="core:TrickModeRestrictionType" minOccurs="0" maxOccurs="unbounded">
						<xsd:annotation>
							<xsd:documentation>Trick modes that are restricted under these terms.</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<xsd:element name="TermsType" type="TermsTypeType" minOccurs="0"/>
					<xsd:element name="TermsDescription" type="core:LocalizableStringType" minOccurs="0" maxOccurs="unbounded">
						<xsd:annotation>
							<xsd:documentation>Descriptive text which explains and/or expounds upon the conditions of the Terms (may be localized to a target language).</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
					<!--  ECN 14.xxx - Added DRMRestrictions -->
					<xsd:element name="DRMRestrictions" type="DRMRestrictionsType" minOccurs="0">
						<xsd:annotation>
							<xsd:documentation>A list of drm/ca systems can be used for this Term</xsd:documentation>
						</xsd:annotation>
					</xsd:element>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	<!-- ECN 14.0094 - added Purchase term type - also added annotations to more clearly describe the usage of values -->
	<xsd:simpleType name="TermsTypeType">
		<xsd:annotation>
			<xsd:documentation>A value representing the type of Terms. The value should come from one of the predefined choices (defined in the pattern) or prefixed with "private:".
			OneTime - able to be rented one time for a period of time
			Recurring - able to access based on a subscription (ex. SVOD) or other service
			Purchase - able to be purchased </xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="core:NonEmptyStringType">
			<xsd:pattern value="(OneTime|Recurring|Purchase|private:.+)"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:element name="Terms" type="TermsType"/>
</xsd:schema>
