<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:libsyn="https://libsyn.com/rss/ns"
  targetNamespace="https://libsyn.com/rss/ns"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified">

  <!--
    Libsyn RSS extension namespace.

    Suggested prefix: libsyn
    Namespace URI:    https://libsyn.com/rss/ns

    Declare on the <rss> element:
      xmlns:libsyn="https://libsyn.com/rss/ns"

    Element definitions are listed below; add more <xs:element>
    declarations here as the extension grows.
  -->

  <xs:simpleType name="timeOffset">
    <xs:annotation>
      <xs:documentation>
        Time offset in MM:SS format. Minutes are unbounded; seconds 00-59.
        Examples: 0:00, 15:30, 125:07.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]+:[0-5][0-9]"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="last-updated" type="xs:dateTime">
    <xs:annotation>
      <xs:documentation>
        Appears as a child of &lt;item&gt;. ISO 8601 timestamp of when the
        item was last modified.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <xs:element name="show-id" type="xs:positiveInteger">
    <xs:annotation>
      <xs:documentation>
        Appears as a child of &lt;channel&gt;. Libsyn internal show ID.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <xs:element name="item-id" type="xs:positiveInteger">
    <xs:annotation>
      <xs:documentation>
        Appears as a child of &lt;item&gt;. Libsyn internal item ID.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <xs:element name="widescreen-image">
    <xs:annotation>
      <xs:documentation>
        Appears as a child of &lt;item&gt;. Widescreen (16:9) episode artwork,
        suitable for use as a video thumbnail. The URL is carried on the
        &lt;href&gt; attribute, mirroring &lt;itunes:image&gt;.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:attribute name="href" type="xs:anyURI" use="required"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="ad-markers">
    <xs:annotation>
      <xs:documentation>
        Appears as a child of &lt;item&gt;. Container of one or more
        &lt;libsyn:ad-marker&gt; entries describing ad insertion points.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="ad-marker" maxOccurs="unbounded">
          <xs:complexType>
            <xs:attribute name="timestamp" type="libsyn:timeOffset" use="optional"/>
            <xs:attribute name="duration" type="libsyn:timeOffset" use="optional"/>
            <xs:attribute name="count" type="xs:positiveInteger" use="required"/>
            <xs:attribute name="type" use="required">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:enumeration value="pre"/>
                  <xs:enumeration value="mid"/>
                  <xs:enumeration value="post"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
