<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.cablelabs.com/namespaces/safi/xsd/cip/I01"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:common="http://www.cablelabs.com/namespaces/safi/xsd/com/I01"
  targetNamespace="http://www.cablelabs.com/namespaces/safi/xsd/cip/I01"
  elementFormDefault="qualified" attributeFormDefault="unqualified" version="I01">
  <xs:import namespace="http://www.cablelabs.com/namespaces/safi/xsd/com/I01"
    schemaLocation="CL-SaFI-COM-I01.xsd"/>

  <xs:annotation>
    <xs:documentation>
      <b>Copyright (C) 2008-2009, Cable Television Laboratories, Inc.</b>
      <b>MSO Campaign Information Package Interface XML Schema Version I01.</b>
    </xs:documentation>
  </xs:annotation>
  <!--    Global Simple Types -->
  <xs:simpleType name="AppMessageTemplateType">
    <xs:annotation>
      <xs:documentation> This identifies a completely defined set of application messages that may
        be issued by an application. It is a key to access the record set in the application message
        template repository. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  <xs:simpleType name="CampaignCreationDateType">
    <xs:annotation>
      <xs:documentation> The time the initial revision of the Campaign Information Package was
        created. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:dateTime"/>
  </xs:simpleType>
  <xs:simpleType name="CampaignRevisionDateType">
    <xs:annotation>
      <xs:documentation> The time this revision of the Campaign Information Package was created.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:dateTime"/>
  </xs:simpleType>
  <xs:simpleType name="CampaignVersionType">
    <xs:annotation>
      <xs:documentation> Campaign version, in most usage the current version is implied when
        omitted. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="common:nonNegativeIntType"/>
  </xs:simpleType>
  <xs:simpleType name="ContactNameType">
    <xs:restriction base="common:nonEmptyStringType">
      <xs:maxLength value="35"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ContactRoleType">
    <xs:restriction base="common:nonEmptyStringType">
      <xs:maxLength value="25"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ElementRevisionDateType">
    <xs:annotation>
      <xs:documentation> The time this revision of the element was created. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:dateTime"/>
  </xs:simpleType>
  <xs:simpleType name="ElementRevisionNumberType">
    <xs:annotation>
      <xs:documentation> A revision number of an element, incremented each time any data is
        modified. No data within an identified element is changed without a new revision number. For
        each element with an ElementRevisionNumber, only the record with the highest revision number
        currently applies. All others records are present for reconciliation or continuity, but are
        not expected to be operable. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="common:nonNegativeIntType"/>
  </xs:simpleType>
  <xs:simpleType name="ElementStateType">
    <xs:annotation>
      <xs:documentation> The current status of the data model of an Element Pending (Pnd)- Data is
        present, but not an operationally complete or consistent set. Committed (Com)- Data is
        present that is an operationally complete and consistent set (although not necessarily
        final. Data may be modified, even when active.) Active - (Act) The data present is intended
        to be operational and the line item should be executed according to the contained
        parameters. This is a statement of intent, not the result of operational feedback. Windup
        (Wnd) - All presentations of the line item should have ceased, but post-processing functions
        may continue. Closed - (Cls) All activity with respect to the line item should be
        terminated. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="pnd"/>
      <xs:enumeration value="com"/>
      <xs:enumeration value="act"/>
      <xs:enumeration value="wnd"/>
      <xs:enumeration value="cls"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="EmailAddressType">
    <xs:restriction base="xs:string">
      <xs:maxLength value="100"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="FlightBeginType">
    <xs:annotation>
      <xs:documentation> The time a broadcast Programming Event is schedule to start. For VOD
        products this is the time they become available on the server. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:dateTime"/>
  </xs:simpleType>
  <xs:simpleType name="FlightEndType">
    <xs:annotation>
      <xs:documentation> The time a broadcast Programming Event is schedule to end. For VOD products
        this is the time they cease to be available on the server. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:dateTime"/>
  </xs:simpleType>
  <xs:simpleType name="FlightNumberType">
    <xs:annotation>
      <xs:documentation> The time domains related to a Programming Event </xs:documentation>
    </xs:annotation>
    <xs:restriction base="common:nonNegativeIntType"/>
  </xs:simpleType>
  <xs:simpleType name="IdentifierOwnerType">
    <xs:annotation>
      <xs:documentation> All identifier owners MUST be set to a registered Internet domain name or a
        qualified domain name that is rooted in a registered internet domain name belonging to the
        provider of the identifier. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:anyURI">
      <xs:maxLength value="255"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="IdentifierIdType">
    <xs:annotation>
      <xs:documentation> Generic owner identifier ID. Identifiers MUST be unique within the
        namespace of their Identifier Owner. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="common:nonEmptyStringType">
      <xs:maxLength value="255"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="MessagePrimaryUrlType">
    <xs:annotation>
      <xs:documentation> A Url directly addressed from applications for app fulfillment and service
        metrics messages. May be distinct from summary level url(s). </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:anyURI"/>
  </xs:simpleType>
  <xs:simpleType name="MessageSecondaryUrlType">
    <xs:annotation>
      <xs:documentation> Url for delivering processed reporting received on the primary url. This
        will be empty if no intermediate processing is defined (e.g., the Primary Url directly
        addressed the final data campaign level data sink). </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:anyURI"/>
  </xs:simpleType>
  <xs:simpleType name="MsoNameType">
    <xs:restriction base="common:nonEmptyStringType">
      <xs:maxLength value="30"/>
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- Was in CommonTypes D01, here starting in D02 -->
  <xs:simpleType name="PhoneNumberType">
    <xs:annotation>
      <xs:documentation> Human-readable contact phone, so may have extension, etc. Not expected to
        be machine processable </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="25"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="PriorityType">
    <xs:annotation>
      <xs:documentation> Placeholder for business terms used by SCTE ADS or equivilent to choose
        amoung conflicting potential placements. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:unsignedInt">
      <xs:maxInclusive value="100"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ProductFamilyType">
    <xs:annotation>
      <xs:documentation> This is a predefined set of known and approved enhanced product families.
        The family is used to direct the interpretation of CIP the data model for a specific
        placement directive. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="VotePoll"/>
      <xs:enumeration value="RFI"/>
      <xs:enumeration value="OnDemandInsertion"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="RecordRevokedFlagType">
    <xs:annotation>
      <xs:documentation> True indicates this record is deprecated. A higher revision will exist with
        the flag false. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean"/>
  </xs:simpleType>
  <xs:simpleType name="RepositoryAppKeyType">
    <xs:annotation>
      <xs:documentation> This identifies a complete application. It is a key to access the
        application characterization in the application repository. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  <xs:simpleType name="RowNumberType">
    <xs:annotation>
      <xs:documentation> Row number is a unique identifier for a specific element in the hierarchy.
        For elements with a Row Number, revisions of the row will be issued, but once assigned the
        row number is never changed. If such a row is totally removed from the business context, but
        later is reinstated, the reinstatement will be assigned a new Line Item Number that is
        unrelated to the original, terminated number. [DVB - unreferenced!] </xs:documentation>
    </xs:annotation>
    <xs:restriction base="common:nonNegativeIntType"/>
  </xs:simpleType>
  <xs:simpleType name="RuleExpressionType">
    <xs:annotation>
      <xs:documentation> Expression string appropriate for parent data domain and associated rule
        engine. Was an xs:string attributed named apRulAtr or smRulAtr in D01. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="common:nonEmptyStringType"/>
  </xs:simpleType>
  <xs:simpleType name="RuleProcessingEngineType">
    <xs:annotation>
      <xs:documentation> The software engine that will be responsible for processing a rule set. Was
        named MsgProcessingEngineType and specific to message processing in D01. The "Undef" type
        generally cannot be processed in the absence of propritetary extensions to this
        specification. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Undef"/>
      <xs:enumeration value="XQuery"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="SyscodeListType">
    <xs:annotation>
      <xs:documentation> SyscodeListType is a white-space delimited list of syscodes
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="common:SyscodeType"/>
  </xs:simpleType>
  <xs:simpleType name="TimezoneCodeType">
    <xs:annotation>
      <xs:documentation> A code for the timezone plan of the national feed. Values are: NATL - Aired
        simultaneously in all timezones from national feed, EMP - Aired with no delay in Eastern,
        local delay in Mountain, and Pacific zones, Central shares Eastern LCL - Aired with local
        delay in all time zones. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="NATL"/>
      <xs:enumeration value="EMP"/>
      <xs:enumeration value="LCL"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TrickModeControlType">
    <xs:annotation>
      <xs:documentation> This will be an enumerated list of defined trick mode options
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  <xs:simpleType name="UuidNameType">
    <xs:annotation>
      <xs:documentation> Human-readable name associated with every UUID to allow meaningful
        communication. Should be chosen to have a very low probability of duplication, but
        uniqueness is neither required nor testable. </xs:documentation>
    </xs:annotation>
    <xs:restriction base="common:nonEmptyStringType">
      <xs:maxLength value="40"/>
    </xs:restriction>
  </xs:simpleType>
  <!--    Global attribute Groups -->
  <xs:attributeGroup name="AssetRefAttributeGroup">
    <xs:annotation>
      <xs:documentation> Global asset identifiers. Needs work to span all expected identifier
        domains </xs:documentation>
    </xs:annotation>
    <xs:attribute name="providerID" type="common:nonEmptyStringType" use="required">
      <xs:annotation>
        <xs:documentation>Provider identification. For example, CableLabs ADI.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="assetID" type="common:nonEmptyStringType" use="required">
      <xs:annotation>
        <xs:documentation>Asset identification and may be scoped by Provider identification. For
          example, CableLabs ADI.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:anyAttribute namespace="##any" processContents="lax"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="ApplicationDefinitionAttributeGroup">
    <xs:annotation>
      <xs:documentation> The attribute set for characterizing an application. The repositoryAppKey
        characterized an application according to the specification format, and the
        OrgID,AppID,version identify a specific expression of that repository template held in the
        application repository. AppId/orgId/appVer are a set, all present or absent. Either that set
        or appDataReverence or both must be present for the applicationDefinition to be valid.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="orgId" type="xs:string" use="optional"/>
    <xs:attribute name="appId" type="xs:string" use="optional"/>
    <xs:attribute name="appVer" type="xs:unsignedInt" use="optional"/>
    <xs:attribute name="appDataReference" type="RepositoryAppKeyType" use="optional"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="CipNotificationGroup">
    <xs:annotation>
      <xs:documentation> Defines data for a Notice operation. Indicates the recipient should fetch
        the referenced Cip. </xs:documentation>
    </xs:annotation>
    <xs:attribute name="CipGUID" type="common:UuidUrlType"/>
    <xs:attribute name="CipGname" type="UuidNameType"/>
    <xs:attribute name="CipVer" type="CampaignVersionType"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="CipSelectorGroup">
    <xs:annotation>
      <xs:documentation> Defines selection criteria for WDSL ReadOp. Must includeCreateFrom+CreateTo
        or GUID or gname or orderId+orderOwner. Date selects CreateFrom LT CipCreateDate and LEQ
        CreateTo so an interval is scanned by repeatedly setting CreateFrom = last returned
        CipCreateDate. Version omitted or zero returns latest version, else specific version
        identified. </xs:documentation>
    </xs:annotation>
    <xs:attribute name="CipCreateFrom" type="CampaignCreationDateType"/>
    <xs:attribute name="CipCreateTo" type="CampaignCreationDateType"/>
    <xs:attribute name="CipGUID" type="common:UuidUrlType"/>
    <xs:attribute name="CipGname" type="UuidNameType"/>
    <xs:attribute name="CipOrderId" type="IdentifierIdType"/>
    <xs:attribute name="CipOrderIdOwner" type="IdentifierOwnerType"/>
    <xs:attribute name="CipVer" type="CampaignVersionType"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="ProcessingRuleAttributeGroup">
    <xs:annotation>
      <xs:documentation> Attributes of application message processing rules. </xs:documentation>
    </xs:annotation>
    <xs:attribute name="RuleEngine" type="RuleProcessingEngineType" use="required"/>
    <xs:anyAttribute/>
  </xs:attributeGroup>
  <xs:attributeGroup name="ContactAttributeGroup">
    <xs:annotation>
      <xs:documentation> Describes one operational contact. Note one of phone or email is required
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="name" type="ContactNameType" use="required"/>
    <xs:attribute name="role" type="ContactRoleType" use="required"/>
    <xs:attribute name="phone" type="PhoneNumberType" use="optional"/>
    <xs:attribute name="email" type="EmailAddressType" use="optional"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="FlightAttributeGroup">
    <xs:annotation>
      <xs:documentation> Attributes applied to one Flight. Describes the window in which the
        presentation is scheduled as a begin/end, and also the window in which responses are
        accepted as a begin/end. Also a TimeZoneCode that indicates what flexibility exists in the
        flight times. </xs:documentation>
    </xs:annotation>
    <xs:attribute name="number" type="FlightNumberType" use="required"/>
    <xs:attribute name="presBegin" type="FlightBeginType" use="required"/>
    <xs:attribute name="presEnd" type="FlightEndType" use="required"/>
    <xs:attribute name="rptBegin" type="FlightBeginType" use="optional"/>
    <xs:attribute name="rptEnd" type="FlightEndType" use="optional"/>
    <xs:attribute name="TzCode" type="TimezoneCodeType" use="optional"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="GuidAttributeGroup">
    <xs:annotation>
      <xs:documentation> Attribute group for all GUIDs </xs:documentation>
    </xs:annotation>
    <xs:attribute name="guid" type="common:UuidUrlType" use="required"/>
    <xs:attribute name="gname" type="UuidNameType" use="optional"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="MsgResultAttributeGroup">
    <xs:annotation>
      <xs:documentation> Attribute group for most message result status </xs:documentation>
    </xs:annotation>
    <xs:attribute name="msgResult">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="OK">
            <xs:annotation>
              <xs:documentation> Accepted </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="NOTOK">
            <xs:annotation>
              <xs:documentation> Rejected although content valid </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="FAIL">
            <xs:annotation>
              <xs:documentation> Rejected because content invalid </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:attributeGroup name="ProductInstanceId">
    <xs:annotation>
      <xs:documentation> Group defining identifiers targeted by an upstream message. Note a peid is
        a Uuid and uses the same Gname semantics as a GuidAttributeGroup (which is an untargetable
        declaration). If no peid is supplied, the value is inherited from the parent. Valid
        documents must have a peid attribute present at or above the level of every element that
        includes a MessageTargetAttributeGroup. </xs:documentation>
    </xs:annotation>
    <xs:attribute name="peid" type="common:PeidType" use="optional"/>
    <xs:attribute name="gname" type="UuidNameType" use="optional"/>
    <xs:attribute name="epsid" type="common:EpsidType" use="required"/>
    <xs:attribute name="productFamily" type="ProductFamilyType" use="optional"/>
  </xs:attributeGroup>

  <xs:attributeGroup name="RecordStatusAttributeGroup">
    <xs:annotation>
      <xs:documentation> Group describing the currency of a document element and it's children.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="RecState" type="ElementStateType" use="required"/>
    <xs:attribute name="RecRevoked" type="RecordRevokedFlagType" use="required"/>
    <xs:attribute name="Revision" type="ElementRevisionNumberType" use="required"/>
    <xs:attribute name="RevDat" type="ElementRevisionDateType" use="required"/>
  </xs:attributeGroup>
  <!-- Global Complex types -->
  <xs:complexType name="AppType">
    <xs:annotation>
      <xs:documentation> This defines the application that implements this placement directive, if
        any </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="ApplicationDefinitionAttributeGroup"/>
    <xs:attribute name="epTypeReference" type="AppMessageTemplateType"/>
    <xs:attribute name="epType" type="AppMessageTemplateType"/>
    <xs:anyAttribute namespace="##other" processContents="skip"/>
  </xs:complexType>

  <xs:complexType name="AppMessageProcessingRulesType">
    <xs:annotation>
      <xs:documentation> Placeholder for TBD processing rules. ApMsgRul from App Messaging Rule
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ApMsgRul" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="AvAssetIdentType">
    <xs:annotation>
      <xs:documentation> Identification for an arbitrary AV asset. When there is more than one
        placement asset, the asset selection filter is a filter expression for selecting the asset
        to use in a given placement. It references a specific set of externally defined data
        elements created this purpose. It includes elements such as impression counts for the asset
        or rotation or episode-based selection from a set of assets. If any Filter rule tests
        daypart then a DaypartXml element must be present to define the daypart test. If more than
        one AssetSelectFilter is present they are processed in document order and combined using the
        TermOperatorType in each term. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="AssetSelectFilter" type="FilterRuleType" minOccurs="0" maxOccurs="unbounded"
      />
    </xs:sequence>
    <xs:attributeGroup ref="AssetRefAttributeGroup"/>
  </xs:complexType>

  <xs:complexType name="CipGeneralType">
    <xs:annotation>
      <xs:documentation> General information for the Campaign Information Package.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Guid" type="GuidType"/>
      <xs:element name="StwShpData" type="StewardshipDataType"/>
      <xs:element name="CipVer" type="CampaignVersionType"/>
      <xs:element name="CipOrdrOwnr" type="IdentifierOwnerType"/>
      <xs:element name="CipOrder" type="IdentifierIdType"/>
      <xs:element name="CipCreDat" type="CampaignCreationDateType"/>
      <xs:element name="CipRevDat" type="CampaignRevisionDateType"/>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="BusinessTermsType">
    <xs:annotation>
      <xs:documentation> Holds data to permit an SCTE 130 ADS or equivilent to choose between
        conficiting placements based on the best business decision. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Priority" type="PriorityType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ElementPlacementType">
    <xs:annotation>
      <xs:documentation> This defines the location in the underlying content in which this element
        occurs or is presented. </xs:documentation>
    </xs:annotation>
    <xs:group ref="PlacementGroup"/>
    <xs:anyAttribute namespace="##other" processContents="skip"/>
  </xs:complexType>

  <xs:complexType name="FilterRuleType" mixed="true">
    <xs:annotation>
      <xs:documentation> The body of this type supplies an expression for a specified expression
        engine </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="ProcessingRuleAttributeGroup"/>
  </xs:complexType>


  <xs:complexType name="ExplicitTargetType">
    <xs:annotation>
      <xs:documentation> This is a container for one explicit target, with an ident and possible
        specific POs </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ProgramIdent" type="common:ProgramType"/>
      <xs:element name="PoFilters" type="PoFiltersType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="FlightType">
    <xs:annotation>
      <xs:documentation> The complete description of one flight of a Programmed event and all its
        enhanced content. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PresStartAdj" minOccurs="0">
        <xs:complexType>
          <xs:attributeGroup ref="common:RelativeTimeAttributeGroup"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="PresEndAdj" minOccurs="0">
        <xs:complexType>
          <xs:attributeGroup ref="common:RelativeTimeAttributeGroup"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attributeGroup ref="FlightAttributeGroup"/>
    <xs:anyAttribute namespace="##other" processContents="skip"/>
  </xs:complexType>

  <xs:complexType name="GuidType">
    <xs:annotation>
      <xs:documentation> Guids are always defined with this type, which provides an alternative
        meaningful human readable name </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="GuidAttributeGroup"/>
  </xs:complexType>

  <xs:complexType name="MsoOrderType">
    <xs:annotation>
      <xs:documentation> The definition of a single MSO order. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Status" type="RecordStatusType"/>
      <!-- This defines  or redefines one or more default programmed events for all systems of this MSO -->
      <xs:element name="ProgEvents" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ProgEvent" type="ProgrammedEventType" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="SysOrders">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="SysOrder" type="SystemOrderType" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="name" type="MsoNameType"/>
  </xs:complexType>

  <xs:complexType name="PackageType">
    <xs:annotation>
      <xs:documentation> The definition of a single enhanced package Instance within the Programmed
        Event. Both placement directives and package elements are optional since one one of either
        is required. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PlacementDirectives" type="PlacementDirectivesType" minOccurs="0"/>
      <xs:element name="PkgElements" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="PkgElement" type="PackageElementType" minOccurs="0"
              maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="PackageElementType">
    <xs:annotation>
      <xs:documentation> The definition of a single package Instance within the Programmed Event. A
        package element may override the definitions found in the Package. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PlacementDirectives" type="PlacementDirectivesType" minOccurs="0"/>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="PlacementDirectiveType">
    <xs:annotation>
      <xs:documentation> This is a container for all properties of one specific placement directive
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Status" type="RecordStatusType"/>
      <xs:element name="Product" type="ProductInstanceType"/>
      <xs:element name="Places" type="PlacementDirectivePlacementType" minOccurs="0"/>
      <xs:element name="AvAssets" type="PlacementDirectiveAvAssetType" minOccurs="0"/>
      <xs:element name="App" type="AppType" minOccurs="0"/>
      <xs:element name="BizTerms" type="BusinessTermsType" minOccurs="0"/>
      <xs:element name="RetData" type="ReturnDataType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="PlacementDirectivesType">
    <xs:annotation>
      <xs:documentation> Hold the set of placement directives for a Programmed Event, Package, or
        Package Element </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PlacementDirective" type="PlacementDirectiveType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="PlacementDirectiveAvAssetType">
    <xs:annotation>
      <xs:documentation> This is a container for the set of audio-visual asset or assets that are
        requirement by a specific placement directive. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="AvAssetIdent" type="AvAssetIdentType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="PlacementDirectivePlacementType">
    <xs:annotation>
      <xs:documentation> The PlaceFilter contains an expression to be applied to a proposed
        placement opportinuity in terms of elements from PO or POIS metadata that will qualify the
        placement of this specific placement directive. If more than one PlaceFilter is present they
        are processed in document order and combined using the TermOperatorType in each term.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PlaceFilter" type="FilterRuleType" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="PlacementGroup"/>
    </xs:sequence>
    <xs:anyAttribute namespace="##other" processContents="skip"/>
  </xs:complexType>

  <xs:complexType name="ProductControlType">
    <xs:annotation>
      <xs:documentation> This holds controls that are to be applied during any occurance of this
        product instance. </xs:documentation>
    </xs:annotation>
    <xs:attribute name="trickMode" type="TrickModeControlType" use="optional"/>
  </xs:complexType>

  <xs:complexType name="ProductInstanceType">
    <xs:annotation>
      <xs:documentation> This element defines an instance of a specific product and makes its parent
        directly referencable by an upstream STB message, based on Peid+Epsid, and the resultant
        node processed based on its EpType. It also holds rules qualifying occurances of the product
        instance and controls to be applied The ProdFilter element defines filter expressions that
        apply to the product placement as a whole, and that are generally specific to the Product
        Family. The domain of data elements is defined independently. For a VOD insertion product
        they might be expected to include impression limits, frequency limits, and daypart or other
        context tests. If more than one ProdFilter is present they are processed in document order
        and combined using the TermOperatorType in each term. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ProdFilter" type="FilterRuleType" minOccurs="0" maxOccurs="unbounded"> </xs:element>
      <xs:element name="ProdControl" type="ProductControlType" minOccurs="0"/>
    </xs:sequence>
    <xs:attributeGroup ref="ProductInstanceId"/>
  </xs:complexType>

  <xs:complexType name="ProgrammedEventType">
    <xs:annotation>
      <xs:documentation> Creates or modifies the definition of one Programming Event. Node Ref and
        status are required in each instance, and Schematron will be used to enforce the existence
        of other critical elements at least once across all levels of defaults. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Status" type="RecordStatusType"/>
      <xs:element name="Peid" type="common:UuidUrlType"/>
      <xs:element name="Flight" type="FlightType"/>
      <xs:element name="Targets" type="TargetsDefinitionType"/>
      <xs:element name="PlacementDirectives" type="PlacementDirectivesType" minOccurs="0"/>
      <xs:element name="Packages" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Package" type="PackageType" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="RecordStatusType">
    <xs:annotation>
      <xs:documentation> This identifies the status of one record, a revision of an element
        instance. </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="RecordStatusAttributeGroup"/>
  </xs:complexType>
  <xs:complexType name="RelativeTimeType">
    <xs:annotation>
      <xs:documentation> This is a time relative to a context-specific event, typically Flight begin
        time. The precision is implicitly to the millisecond to permit frame sync.
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="common:RelativeTimeAttributeGroup"/>
    <xs:anyAttribute namespace="##other" processContents="skip"/>
  </xs:complexType>

  <xs:complexType name="ReturnDataType">
    <xs:annotation>
      <xs:documentation> The complete definition of return data for one EpType. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PriUrl" type="MessagePrimaryUrlType" minOccurs="0"/>
      <xs:element name="AppMsgs" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="AppMessageProcessingGroup"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="SmMsgs" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="SmMessageProcessingGroup"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="StewardshipDataType">
    <xs:annotation>
      <xs:documentation> Stewardship references to the data that generated this campaign.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Contact" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attributeGroup ref="ContactAttributeGroup"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="idOwner" type="IdentifierOwnerType" use="required"/>
    <xs:attribute name="id" type="IdentifierIdType" use="required"/>
  </xs:complexType>

  <xs:complexType name="SmMessageProcessingRulesType">
    <xs:annotation>
      <xs:documentation> Placeholder for TBD processing rules. SmMsgRul from Service Metrics
        Messaging Rule </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="SmMsgRul" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="SystemOrderType">
    <xs:annotation>
      <xs:documentation> The definition of a single system order. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Syscode" type="common:SyscodeType"/>
      <xs:element name="Status" type="RecordStatusType"/>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
      <!-- This defines or redefines one or more specific  programmed events for this system -->
      <xs:element name="ProgEvents" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ProgEvent" type="ProgrammedEventType" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="TargetsDefinitionType">
    <xs:annotation>
      <xs:documentation> This is a container for all information defining or qualifying a set of
        target assets of a placement directive. It includes qualification rules, expected placments,
        and specific asset identifications. Qualifications and explicit are optional since either
        can occur alone. However at least one placment is required. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TargetFilters" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="TargetFilter" type="TargetFilterType" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ExplicitTargets" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ExplicitTarget" type="ExplicitTargetType" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="PoFilters" type="PoFiltersType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="TargetFilterType">
    <xs:annotation>
      <xs:documentation> The body of this type supplies an expression for testing whether the
        campaign applies to a specific target using a specified expression engine. If more than one
        FilterRule is present they are processed in document order and combined using the
        TermOperatorType in each term. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="FilterRules">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="FilterRule" type="FilterRuleType" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="PoFilters" type="PoFiltersType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="PoFiltersType">
    <xs:annotation>
      <xs:documentation> The PoFilter element defines a string expression for a specified expression
        engine that filters or qualifies the set of placement opportunities required by this
        placement directive. The expression is in terms of PlacementOpportunity and descendants in
        the PlacementRequest, or POIS data obtained for a placement opportunity. If more than one
        PoFilter is present they are processed in document order and combined using the
        TermOperatorType in each term. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PoFilter" type="FilterRuleType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <!-- Model Groups -->
  <xs:group name="AppMessageProcessingGroup">
    <xs:annotation>
      <xs:documentation> The complete definition of MSO-level processing for app messages related to
        one Epsid. This may include expression strings to be processed by a specified expression
        engine that are applied to app messages. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ProcRules" minOccurs="0">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="AppMessageProcessingRulesType">
              <xs:attributeGroup ref="ProcessingRuleAttributeGroup"/>
              <xs:anyAttribute namespace="##other" processContents="skip"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="ApSecUrl" type="MessageSecondaryUrlType" minOccurs="0"/>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
    </xs:sequence>
  </xs:group>
  <xs:group name="PlacementGroup">
    <xs:annotation>
      <xs:documentation> Arbitrary placement opportunity in the underlying content defined as either
        a DVS 629 placement or as a relative time to the actual start of flight. A relative time
        without an interval implies the actual duration of the flight. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <!-- Choice of two -->
      <xs:element name="Time" type="RelativeTimeType" minOccurs="0" maxOccurs="1"/>
      <xs:group ref="SegmentationUpidGroup" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
  </xs:group>
  <xs:group name="SegmentationUpidGroup">
    <xs:annotation>
      <xs:documentation> The DVS 629 SegmentationUpid element's value is of type xs:hexBinary and
        contains the SCTE 35 segmentation_upid bit field. The value should not be empty. The value
        is specific to the @type attribute and shall meet the requirements as specified in SCTE 35.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="SegmentationUpid" type="common:Scte35SegmentationUpidType" minOccurs="0"/>
    </xs:sequence>
  </xs:group>
  <xs:group name="SmMessageProcessingGroup">
    <xs:annotation>
      <xs:documentation> The complete definition of MSO-level processing for Service Metrics
        messages related to one Epsid. This may include expression strings to be processed by a
        specified expression engine that are applied to sm messages. </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ProcRules" minOccurs="0">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="SmMessageProcessingRulesType">
              <xs:attributeGroup ref="ProcessingRuleAttributeGroup"/>
              <xs:anyAttribute namespace="##other" processContents="skip"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="SmSecUrl" type="MessageSecondaryUrlType" minOccurs="0"/>
      <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
    </xs:sequence>
  </xs:group>
  <xs:element name="CampInfoPkg">
    <xs:annotation>
      <xs:documentation> Advanced Advertising MSO Campaign Information Package document root element
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Version" type="common:VersionType"/>
        <xs:element name="Gen" type="CipGeneralType"/>
        <!-- This defines one or more default programmed event(s) at all MSOs -->
        <xs:element name="ProgEvents" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ProgEvent" type="ProgrammedEventType" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="MsoOrders">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="MsoOrder" type="MsoOrderType" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Ext" type="common:ExtType" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="NotifyRequest">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>Element for Notify message</xs:documentation>
      </xs:annotation>
      <xs:sequence/>
      <xs:attributeGroup ref="CipNotificationGroup"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="NotifyResponse">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>Response for Notify message</xs:documentation>
      </xs:annotation>
      <xs:sequence/>
      <xs:attributeGroup ref="MsgResultAttributeGroup"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="ReadRequest">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>Element for Read message</xs:documentation>
      </xs:annotation>
      <xs:sequence/>
      <xs:attributeGroup ref="CipSelectorGroup"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="ReadResponse">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>Response for Read message</xs:documentation>
      </xs:annotation>
      <xs:sequence>
        <xs:element ref="CampInfoPkg" minOccurs="0"/>
      </xs:sequence>
      <xs:attributeGroup ref="MsgResultAttributeGroup"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="SetRegistrationRequest">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation> Element for SetRegistration message. Identifies target URL,boolean sets
          as enabled or disabled for distributions. If enabled, syscode list is required, exclusive
          registration for each</xs:documentation>
      </xs:annotation>
      <xs:sequence>
        <xs:element name="Subscriber" type="xs:anyURI"/>
        <xs:element name="Active" type="xs:boolean"/>
        <xs:element name="Syscodes" type="common:SyscodeType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="SetRegistrationResponse">
    <xs:complexType mixed="true">
      <xs:annotation>
        <xs:documentation>Response for SetRegistration message. Note that if any syscode of an
          enabled registration is already registered to another Subscriber the registration fails.
          In tis case a reponse of "NOTOK" with a reason of "Syscode not Unique" will be returned,
          and the text will contain a space-delimited list of the errored syscode(s).
        </xs:documentation>
      </xs:annotation>
      <xs:sequence/>
      <xs:attributeGroup ref="MsgResultAttributeGroup"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="InvalidRequest">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>Contents of fault on Read Request.</xs:documentation>
      </xs:annotation>
      <xs:sequence>
        <xs:element name="Reason">
          <xs:simpleType>
            <xs:restriction base="xs:NMTOKEN">
              <xs:enumeration value="From-ToNotPaired"/>
              <xs:enumeration value="IdOwnerNotPaired"/>
              <xs:enumeration value="NoSelection"/>
              <xs:enumeration value="NoneFound"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element name="Values">
          <xs:complexType>
            <xs:sequence/>
            <xs:attributeGroup ref="CipSelectorGroup"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

