<?xml version="1.0" encoding="UTF-8"?>
<!-- ************************************************************************** -->
<!-- Author: Joseph Collins                                                                                -->
<!-- Property of: eMusic.com                                                                             -->
<!--                                                                                                                 -->
<!-- Dates are all in the form YYYY-MM-DD                                                        -->
<!-- CHANGE HISTORY                                                                                      -->
<!-- 2.0.1 - May 23 2005                                                                                 -->
<!--         Added song_rights_type                                                                      -->
<!--         Added song_rights_element                                                                 -->
<!--         Constrained UPC_type length                                                               -->
<!-- **************************************************************************  -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="feed" type="feed_type"/>
    <!-- ************************************************************************** -->
    <!-- Feed Type -->
    <!-- ************************************************************************** -->
    <xs:complexType name="feed_type">
        <xs:all minOccurs="1">
            <xs:element name="album" minOccurs="1" maxOccurs="1" type="album_type"/>
        </xs:all>
        <xs:attribute name="version" type="xs:string"  default="2.0.2" />
        <xs:attribute name="action" type="action_type" use="required"/>
        <xs:attribute name="partner_id" type="partner_id_type" use="required"/>
        <xs:attribute name="partner_album_id" type="display_sm_type" use="required"/>
    </xs:complexType>
    <!-- ************************************************************************** -->
    <!-- action type -->
    <!-- ************************************************************************** -->
    <xs:simpleType name="action_type">
        <xs:restriction base="xs:string">
            <xs:enumeration value="insert"/>
            <xs:enumeration value="update"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- ************************************************************************** -->
    <!-- Album Type -->
    <!-- ************************************************************************** -->
    <xs:complexType name="album_type">
        <xs:all minOccurs="1" maxOccurs="1">
            <xs:element name="title" maxOccurs="1" minOccurs="1" type="display_type"
                nillable="false"/>
            <xs:element name="title_sort" maxOccurs="1" minOccurs="1" type="display_type"
                nillable="false"/>
            <xs:element name="UPC" minOccurs="1" maxOccurs="1" type="UPC_type" nillable="false"/>
            <xs:element name="label" minOccurs="1" maxOccurs="1" nillable="false" type="label_type"/>
            <xs:element name="main_genre" minOccurs="1" maxOccurs="1" nillable="false"
                type="genre_type"/>
            <xs:element name="sub_genres" minOccurs="0" maxOccurs="1" nillable="false"
                type="sub_genres_type"/>
            <xs:element name="release_date" minOccurs="0" maxOccurs="1" nillable="true"
                type="xs:date">
                <xs:annotation>
                    <xs:documentation> The date the album is was released. </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="street_date" minOccurs="0" maxOccurs="1" type="xs:date"
                nillable="true">
                <xs:annotation>
                    <xs:documentation> The date the album is available for sale to eMusic customers.
                        Albums will not be published to eMusic.com untill the street date is greater
                        or equal to the current date. </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="emu_venue_id" minOccurs="0" maxOccurs="1" nillable="true"
                type="xs:unsignedInt">
                <xs:annotation>
                    <xs:documentation> The eMusic Venue ID where the album was recorded. eMusiclive
                        Only </xs:documentation>
                </xs:annotation>
            </xs:element>
            <!-- The display name of the artist -->
            <xs:element name="artist_display" maxOccurs="1" minOccurs="1" type="display_type"
                nillable="false">
                <xs:annotation>
                    <xs:documentation> The name displayed on the album page. Examples - various
                        artists, Miles Davis and The All Stars. </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="artist_display_sort" maxOccurs="1" minOccurs="1" type="display_type"
                nillable="false">
                <xs:annotation>
                    <xs:documentation> The sorted artist name displayed on the album page.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="artists" minOccurs="0" maxOccurs="1" type="artists_type">
                <xs:annotation>
                    <xs:documentation> Per album artist information. Don't put Various Artists here.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="number_of_discs" minOccurs="1" maxOccurs="1" type="xs:unsignedInt"/>
            <xs:element name="discs" minOccurs="1" maxOccurs="1" type="discs_type"/>
            <xs:element name="country_restrictions" minOccurs="0" maxOccurs="1"
                type="country_restrictions_type"/>
            <xs:element name="amg_a_id" minOccurs="0" maxOccurs="1" type="amg_id_type"
                nillable="true"/>
            <xs:element name="is_single_ep" minOccurs="0" maxOccurs="1" type="xs:boolean"
                default="false">
                <xs:annotation>
                    <xs:documentation> The album is either a single or an EP release
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="is_live" minOccurs="0" maxOccurs="1" type="xs:boolean" default="false">
                <xs:annotation>
                    <xs:documentation> The album was recorded live </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="is_compilation" minOccurs="0" maxOccurs="1" type="xs:boolean"
                default="false">
                <xs:annotation>
                    <xs:documentation> The album is a compilation release - ie - Best of, or Boxed
                        set release. NOT A COLLABORATION - ie Various Artists </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="explicit_lyrics" minOccurs="0" maxOccurs="1" type="xs:boolean"
                default="false"/>
            <xs:element name="instruments" minOccurs="0" maxOccurs="1" nillable="false"
                type="instrument_type"/>
            <xs:element name="language" minOccurs="0" maxOccurs="1" type="xs:unsignedInt">
                <xs:annotation>
                    <xs:documentation>Language ID as specified in emu_genres.xls</xs:documentation>
                </xs:annotation>               
            </xs:element>
            <xs:element name="recording_date" minOccurs="0" maxOccurs="1" nillable="true"
                type="xs:date">
                <xs:annotation>
                    <xs:documentation> The date the album/work was recorded. Classical only </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="recording_venue" minOccurs="0" maxOccurs="1" nillable="true" type="display_type"></xs:element>
            <xs:element name="musical_period" minOccurs="0" maxOccurs="1" type="musical_period_type"></xs:element>
        </xs:all>
    </xs:complexType>
    <!-- ************************************************************************** -->
    <!-- Disc Type -->
    <!-- ************************************************************************** -->
    <xs:complexType name="discs_type">
        <xs:sequence>
            <xs:element name="disc" type="disc_type" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="disc_type">
        <xs:all>
            <xs:element name="disc_name" maxOccurs="1" minOccurs="1" nillable="true"
                type="display_type"/>
            <xs:element name="disc_number" minOccurs="1" maxOccurs="1" nillable="false"
                type="xs:unsignedShort"/>
            <xs:element name="number_of_songs" minOccurs="1" maxOccurs="1" nillable="false"
                type="xs:unsignedShort"/>
            <xs:element name="songs" minOccurs="1" maxOccurs="1" type="songs_type"/>
        </xs:all>
    </xs:complexType>
    <!-- ************************************************************************** -->
    <!-- artist type -->
    <!-- ************************************************************************** -->
    <xs:complexType name="artists_type">
        <xs:sequence>
            <xs:element name="artist" type="artist_type" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="artist_type">
        <xs:all>
            <xs:element name="name" minOccurs="1" maxOccurs="1" type="display_type" nillable="false"/>
            <xs:element name="name_sort" minOccurs="1" maxOccurs="1" type="display_type"
                nillable="false"/>
            <xs:element name="role" minOccurs="1" maxOccurs="1" type="artist_role_type"
                default="performer"/>
            <!-- birhplace/origin -->
            <xs:element name="birth_place" minOccurs="0" maxOccurs="1" type="display_sm_type"
                nillable="true"/>
            <xs:element name="birth_date" minOccurs="0" maxOccurs="1" type="xs:date" nillable="true"/>
            <xs:element name="death_place" minOccurs="0" maxOccurs="1" type="display_sm_type"
                nillable="true"/>
            <xs:element name="death_date" minOccurs="0" maxOccurs="1" type="xs:date" nillable="true"/>
            <xs:element name="amg_p_id" minOccurs="0" maxOccurs="1" type="amg_id_type"
                nillable="true"/>
            <xs:element name="biography" minOccurs="0" maxOccurs="1" nillable="true"
                type="xs:string"/>
            <xs:element name="nationality" minOccurs="0" maxOccurs="1" type="display_type" nillable="true"/>
        </xs:all>
        <xs:attribute name="is_primary" use="optional" default="false" type="xs:boolean"/>
    </xs:complexType>
    <!-- ************************************************************************** -->
    <!-- song type -->
    <!-- ************************************************************************** -->
    <xs:complexType name="songs_type">
        <xs:sequence>
            <xs:element name="song" type="song_type" minOccurs="1" maxOccurs="unbounded"
                nillable="false"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="song_type">
        <xs:all>
            <xs:element name="name" minOccurs="1" maxOccurs="1" nillable="false" type="display_type"/>
            <xs:element name="name_sort" minOccurs="1" maxOccurs="1" nillable="false"
                type="display_type"/>
            <xs:element name="movement" minOccurs="0" maxOccurs="1" nillable="false"
                type="display_type"/>
            <xs:element name="song_rights" type="song_rights_type" minOccurs="1" maxOccurs="1" nillable="false" default="download"></xs:element>
            <xs:element name="isrc" minOccurs="1" maxOccurs="1" nillable="false" type="isrc_type"/>
            <xs:element name="length" minOccurs="1" maxOccurs="1" nillable="false"
                type="xs:unsignedInt">
                <xs:annotation>
                    <xs:documentation>length of the song in seconds</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="track_number" minOccurs="1" maxOccurs="1" nillable="false"
                type="xs:unsignedInt">
                <xs:annotation>
                    <xs:documentation>The position the song occurs on the disc</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="street_date" minOccurs="0" maxOccurs="1" type="xs:date"
                nillable="true">
                <xs:annotation>
                    <xs:documentation> The date the song may go on sale at eMusic. The song will not
                        be downloadable before this date. </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="artist_display" maxOccurs="1" minOccurs="1" type="display_type"
                nillable="false">
                <xs:annotation>
                    <xs:documentation> The artist name displayed next to each track. Example - Miles
                        Davis &amp; Duke Ellington. Don't put "Various Artists" here.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="artists" minOccurs="0" maxOccurs="1" type="artists_type">
                <xs:annotation>
                    <xs:documentation> Per song artist information. Do not put "Various Artists"
                        here. </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="year_composed" minOccurs="0" maxOccurs="1" type="xs:unsignedInt">               
                <xs:annotation>
                    <xs:documentation> Year the song was composed. Classical only. YYYY format</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:all>
    </xs:complexType>
    <!-- ************************************************************************** -->
    <!-- label type -->
    <!-- ************************************************************************** -->
    <xs:complexType name="label_type">
        <xs:all>
            <xs:element name="name" minOccurs="1" maxOccurs="1" type="display_type" nillable="false"/>
            <xs:element name="name_sort" minOccurs="1" maxOccurs="1" type="display_type"
                nillable="false"/>
            <xs:element name="blurb" minOccurs="0" maxOccurs="1" nillable="true" type="xs:string">
                <xs:annotation>
                    <xs:documentation> Text description of the label. </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:all>
    </xs:complexType>
    <!-- ************************************************************************** -->
    <!-- genre type -->
    <!-- ************************************************************************** -->
    <xs:complexType name="genre_type">       
        <xs:sequence>
            <xs:element name="emu_id" minOccurs="1" maxOccurs="1" type="xs:unsignedInt"
                nillable="false"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="sub_genres_type">
        <xs:sequence>
            <xs:element name="sub_genre" type="genre_type" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- ************************************************************************** -->
    <!-- Display type - album title, artist name, etc -->
    <!-- ************************************************************************** -->
    <xs:simpleType name="display_type">
        <xs:restriction base="xs:string">                        
            <xs:maxLength value="300"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="display_sm_type">
        <xs:restriction base="xs:string">
            <xs:maxLength value="100"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- AMG ID type -->
    <xs:simpleType name="amg_id_type">
        <xs:restriction base="xs:string">
            <xs:maxLength value="10"/>
            <xs:minLength value="10"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- ISRC type -->
    <xs:simpleType name="isrc_type">
        <xs:restriction base="xs:string">
            <xs:maxLength value="12"/>
            <xs:minLength value="12"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- partner ID type -->
    <xs:simpleType name="partner_id_type">
        <xs:restriction base="xs:string">
            <xs:minLength value="2"/>
            <xs:maxLength value="5"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- artist role type -->
    <xs:simpleType name="artist_role_type">
        <xs:restriction base="xs:string">
            <xs:enumeration value="performer"/>
            <xs:enumeration value="conductor"/>
            <xs:enumeration value="soloist"/>
            <xs:enumeration value="composer"/>
            <xs:enumeration value="ensemble"/>
            <xs:enumeration value="orchestra"/>
            <xs:enumeration value="choir"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- Country Restrictions Type -->
    <xs:complexType name="country_restrictions_type">
        <xs:choice>
            <xs:element name="allow" minOccurs="0" maxOccurs="unbounded" type="country_code_type">
                <xs:annotation>
                    <xs:documentation> ISO Country Codes ex: US, NA, etc.
                        http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
                        only customers from countries in the list can download the album
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="disallow" minOccurs="0" maxOccurs="unbounded" type="country_code_type">
                <xs:annotation>
                    <xs:documentation> ISO Country Codes ex: US, NA, etc.
                        http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
                        customers from countries in the list can NOT download the album
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
    </xs:complexType>
    <xs:simpleType name="country_code_type">
        <xs:restriction base="xs:string">
            <xs:minLength value="2"/>
            <xs:maxLength value="3"/>
            <!-- Should probably paste iso codes in here as enumerations -->
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="UPC_type">
        <xs:restriction base="xs:string">
            <xs:minLength value="10"/>
            <xs:maxLength value="13"/>
        </xs:restriction>
    </xs:simpleType>
    
    <!-- song rights type -->
    <xs:simpleType name="song_rights_type">
        <xs:restriction base="xs:string">
            <xs:enumeration  value="download"/>
            <xs:enumeration value="none"/>            
        </xs:restriction>
    </xs:simpleType>
    <!-- Instrument type -->
    <xs:complexType name="instrument_type">       
        <xs:sequence>
            <xs:element name="ins_id" minOccurs="1" maxOccurs="unbounded" type="xs:unsignedInt"
                nillable="false"/>
        </xs:sequence>
    </xs:complexType>
    <!-- musical period type -->
    <xs:simpleType name="musical_period_type">
        <xs:restriction base="xs:string">
            <xs:enumeration value="medieval"/>
            <xs:enumeration value="renaissance"/>
            <xs:enumeration value="baroque"/>
            <xs:enumeration value="classical"/>
            <xs:enumeration value="romantic"/>
            <xs:enumeration value="post-romantic"/>
            <xs:enumeration value="modern"/>
            <xs:enumeration value="avant-garde"/>
            <xs:enumeration value="post-modern"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
