<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.isan.org/schema/v1.21/common/serial" xmlns:isan="http://www.isan.org/ISAN/isan"
    xmlns:common="http://www.isan.org/schema/v1.11/common/common"
    xmlns:title="http://www.isan.org/schema/v1.11/common/title"
    xmlns:participant="http://www.isan.org/schema/v1.11/common/participant"
    targetNamespace="http://www.isan.org/schema/v1.21/common/serial" elementFormDefault="qualified"
    version="1.1">
    
    <xs:import namespace="http://www.w3.org/XML/1998/namespace"
        schemaLocation="http://www.w3.org/2001/XML.xsd"/>
    <xs:import namespace="http://www.isan.org/schema/v1.11/common/common"
        schemaLocation="http://www.isan.org/schema/v1.11/common/common.xsd"/>
    <xs:import namespace="http://www.isan.org/ISAN/isan"
        schemaLocation="http://www.isan.org/ISAN/isan.xsd"/>
    <xs:import namespace="http://www.isan.org/schema/v1.11/common/title"
        schemaLocation="http://www.isan.org/schema/v1.11/common/title.xsd"/>
    
    <xs:import namespace="http://www.isan.org/schema/v1.11/common/participant"
        schemaLocation="http://www.isan.org/schema/v1.11/common/participant.xsd"/>
    
    <xs:complexType name="SeriaHeaderListType">
        <xs:sequence>
            <xs:element name="SerialHeader" maxOccurs="unbounded" type="SerialHeaderType"/>
        </xs:sequence>
    </xs:complexType>
    
    
    
    <xs:complexType name="SerialHeaderType">
        <xs:complexContent>
            <xs:extension base="common:ISANDataType">
                <xs:sequence>
                    <xs:choice>
                        <xs:element name="SerialHeaderRegistrantId" type="common:IdType"/>
                        <xs:element name="SerialHeaderId" type="isan:isanType"/>
                    </xs:choice>
                    <xs:element name="MainTitles" type="title:TitleListType"/>
                    <xs:element name="TotalEpisodes" type="xs:integer" minOccurs="0"/>
                    <xs:element name="TotalSeasons" type="xs:integer" minOccurs="0"/>
                    <xs:element name="MinDuration" type="common:DurationType" minOccurs="0"/>
                    <xs:element name="MaxDuration" type="common:DurationType" minOccurs="0" />
                    <xs:element name="MinYear" type="common:YearType" />
                    <xs:element name="MaxYear" type="common:YearType" minOccurs="0"/>
                    <xs:element name="MainParticipantList" type="participant:ParticipantListType" minOccurs="0"/>
                    <xs:element name="CompanyList" type="common:CompanyListType" minOccurs="0" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    
    
    <xs:simpleType name="SeasonType">
        <xs:restriction base="xs:string">
            <xs:maxLength value="5"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="EpisodeType">
        <xs:restriction base="xs:string">
            <xs:maxLength value="9"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:complexType name="EpisodeDetailType">
        <xs:sequence>
            <xs:choice>
                <xs:element name="SerialHeaderRegistrantId" type="common:IdType"/>
                <xs:element name="SerialHeaderId" type="isan:isanType"/>
            </xs:choice>
            <xs:element name="Season" type="SeasonType" minOccurs="0"/>
            <xs:element name="Episode" type="EpisodeType" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    
    <xs:complexType name="EpisodeWorkMetadataListType">
        <xs:sequence>
            <xs:annotation>
                <xs:documentation xml:lang="EN"> The WorkMetadata element contains all the metadata
                    to define an ISAN work, relevant for ISAN registration or presentation
                </xs:documentation>
            </xs:annotation>
            <xs:element name="WorkMetadata" type="EpisodeWorkMetadataType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    
    
    
    <xs:complexType name="EpisodeWorkMetadataType">
        <xs:complexContent>
            <xs:extension base="common:WorkMetadataType">
                <xs:sequence>
                    <xs:element name="EpisodeDetails" type="EpisodeDetailType" minOccurs="1"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    
    
</xs:schema>

