<?xml version="1.0" encoding="utf-8"?>
<!--
    OnTheAir Video Playlist Schema (Version 4.0)

    PURPOSE:
    This XML Schema Definition (XSD) defines the structure and validation rules
    for OnTheAir Video playlist documents. It supports both traditional file-based
    workflows and modern Media Browser database-based workflows.

    FEATURES:
    - Playlist-level settings (loop, chain, cue, MIDI, window state)
    - Individual playlist items with extensive media properties
    - Modern action system with multiple action groups (AppleScript, GPI, SCTE, ATEM, etc.)
    - Support for transitions, graphics overlays, and CG projects
    - Validation and codec detection metadata
    - Traffic system integration (BXF, MOS, reconciliation)
    - Flexible metadata containers for extensibility

    USAGE:
    Playlists can be created/edited either:
    1. Through the OnTheAir Video GUI
    2. Programmatically using this schema as a guide
    3. Via third-party automation and traffic systems

    VALIDATION:
    When creating playlists programmatically:
    - Always include uniqueID for each playlist item
    - Include either mediaFilePath OR mediaBrowserItemUniqueID
    - Do not manually set auto-managed validation fields
    - OnTheAir Video will validate and populate metadata upon loading

    EXAMPLE MINIMAL PLAYLIST:
    <?xml version="1.0" encoding="utf-8"?>
    <playlistDocument version="4.0">
        <settings>
            <loop>false</loop>
            <chain>false</chain>
        </settings>
        <playlistItem>
            <uniqueID>item-001</uniqueID>
            <mediaFilePath xml:space="preserve">/Path/To/Video.mov</mediaFilePath>
            <displayName xml:space="preserve">My Video Clip</displayName>
        </playlistItem>
    </playlistDocument>

    VERSION HISTORY:
    - 4.0: Modern action system, Media Browser support, extended metadata
    - 3.x: Added BXF/MOS integration, CG projects
    - 2.x: Added transitions, MIDI support
    - 1.x: Initial release

    COPYRIGHT:
    (c) Softron Media Services. All rights reserved.
    https://www.softron.tv

    SUPPORT:
    For technical support and documentation:
    https://www.softron.tv/support
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
    <!-- Defines the "preserve space" string -->
    <xs:complexType name="nonEmptyStringWithSpaces">
        <xs:simpleContent>
            <xs:restriction base="stringWithSpaces">
                <xs:minLength value="2"/>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="stringWithSpaces">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute ref="xml:space" default="preserve"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>    
    <!-- Defines the counter mode (playlist or item) -->
    <xs:simpleType name="counterModeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="item"/>
            <xs:enumeration value="playlist"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- Defines the counter mode (playlist or item) -->
    <xs:complexType name="string-with-xml-space">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute ref="xml:space"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <!-- Defines the playback mode (used to be the clip end behaviour) -->
    <xs:simpleType name="playbackModeType">
        <xs:annotation>
            <xs:documentation>
                Playback Mode Type

                Defines how an item behaves when it reaches its end point.

                Values:
                - normal: Stop at end, wait for next item or user action
                - chain: Seamlessly transition to next item (no gap)
                - loop: Repeat this item continuously until manually stopped
                - holdLastFrame: Freeze on last frame when item ends
                - undefined: Not set, use playlist default behavior
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="normal">
                <xs:annotation>
                    <xs:documentation>Stop at end, wait for next item</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="chain">
                <xs:annotation>
                    <xs:documentation>Seamlessly chain to next item</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="loop">
                <xs:annotation>
                    <xs:documentation>Loop this item continuously</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="holdLastFrame">
                <xs:annotation>
                    <xs:documentation>Freeze on last frame</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="undefined">
                <xs:annotation>
                    <xs:documentation>Use default behavior</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <!-- Defines the clip validation status. -->
    <xs:simpleType name="validationStatusType">
        <xs:annotation>
            <xs:documentation>
                Validation Status Type

                WARNING: AUTO-MANAGED FIELD !!!
                This field is automatically set by OnTheAir Video during media validation.
                Do not manually set this value as it will be overwritten, and it's the engine's responsibility to set if a media is valid or not.

                Values:
                - notYetValidated: Initial state, validation pending
                - valid: Media file validated successfully, ready for playback
                - invalid: Media file has errors or is not supported
                - offline: Media file is not accessible (missing, unmounted volume, etc.)
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="invalid">
                <xs:annotation>
                    <xs:documentation>Media file is invalid or unsupported</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="valid">
                <xs:annotation>
                    <xs:documentation>Media file validated successfully</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="offline">
                <xs:annotation>
                    <xs:documentation>Media file is not accessible</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="notYetValidated">
                <xs:annotation>
                    <xs:documentation>Initial state, validation pending</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <!-- Defines the various resize modes -->
    <xs:simpleType name="resizeModeType">
        <xs:annotation>
            <xs:documentation>
                Resize Mode Type

                Defines how media is scaled to fit the output canvas when aspect ratios differ.

                Values:
                - fill: Stretch/squeeze to fill entire canvas (may distort)
                - letterbox: Preserve aspect ratio, add black bars if needed
                - panAndScan: Crop to fill canvas, preserve aspect ratio
                - natural: Display at natural size (no scaling)
                - default: Use default resize mode from preferences
                - (empty): Use default resize mode from preferences
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="fill">
                <xs:annotation>
                    <xs:documentation>Stretch to fill canvas (may distort)</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="letterbox">
                <xs:annotation>
                    <xs:documentation>Add black bars to preserve aspect ratio</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="panAndScan">
                <xs:annotation>
                    <xs:documentation>Crop to fill while preserving aspect ratio</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="natural">
                <xs:annotation>
                    <xs:documentation>Display at natural size, no scaling</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="default">
                <xs:annotation>
                    <xs:documentation>Use default from preferences</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="">
                <xs:annotation>
                    <xs:documentation>Use default from preferences</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
	<!-- Defines the various resize modes options -->
	<xs:simpleType name="resizeModeOptionType">
        <xs:annotation>
            <xs:documentation>
                Resize Mode Option Type

                Specifies the anchor position for certain resize modes (letterbox, panAndScan).
                Determines where the content is positioned within the canvas.

                Layout (3x3 grid):
                topleft      topcenter      topright
                middleleft   center         middleright
                bottomleft   bottomcenter   bottomright

                - default: Use application default (typically center)
                - center: Center the content (most common)
                - Other values: Position content at specified anchor point
            </xs:documentation>
        </xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="default">
                <xs:annotation>
                    <xs:documentation>Use default positioning</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="topleft">
                <xs:annotation>
                    <xs:documentation>Anchor to top-left corner</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="topcenter">
                <xs:annotation>
                    <xs:documentation>Anchor to top-center</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="topright">
                <xs:annotation>
                    <xs:documentation>Anchor to top-right corner</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="middleleft">
                <xs:annotation>
                    <xs:documentation>Anchor to middle-left</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="center">
                <xs:annotation>
                    <xs:documentation>Center the content</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="middleright">
                <xs:annotation>
                    <xs:documentation>Anchor to middle-right</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="bottomleft">
                <xs:annotation>
                    <xs:documentation>Anchor to bottom-left corner</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="bottomcenter">
                <xs:annotation>
                    <xs:documentation>Anchor to bottom-center</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
			<xs:enumeration value="bottomright">
                <xs:annotation>
                    <xs:documentation>Anchor to bottom-right corner</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
    <!-- Defines a MIDI note (for equivalents) -->
    <xs:complexType name="MIDINoteElement">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="note">
                    <xs:simpleType>
                        <xs:restriction base="xs:integer">
                            <xs:minInclusive value="0"/>
                            <xs:maxInclusive value="255"/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
                <xs:attribute name="channel">
                    <xs:simpleType>
                        <xs:restriction base="xs:integer">
                            <xs:minInclusive value="0"/>
                            <xs:maxInclusive value="255"/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <!-- Defines an action (modern action system) -->
    <xs:element name="action">
        <xs:annotation>
            <xs:documentation>
                Actions (Secondary events)

                Actions are triggered at specific times during playlist item playback.
                Each action has a unique ID, group, position specification, and optional parameters.

                ACTION GROUPS:
                - AppleScript: Execute AppleScript code
                - Playback: Control playback (play, pause, stop, skip, etc.)
                - GPI: General Purpose Interface triggers
                - Graphics: Control graphics overlays and CG projects
                - SCTE: SCTE-104 triggering for broadcast automation
                - ATEM: BlackmagicDesign ATEM switcher control
                - Custom: User-defined custom action plugins

                POSITION TYPES (when to trigger):
                - beforeStart: Before item starts playing
                - fromStart: Specified seconds from item start
                - fromEnd: Specified seconds before item ends
                - atIn: At the in-point
                - atOut: At the out-point
                - absolute: At absolute time (with dateTime)

                PARAMETER TYPES:
                - string: Text parameter
                - integer: Whole number parameter
                - double: Decimal number parameter
                - boolean: True/false parameter
                - multiple: Multiple values (comma-separated)
                - blob: Binary data (base64 encoded)

                Note: Custom actions can define their own parameter types and behaviors.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="parameters" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="parameter" minOccurs="0" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute name="key" type="xs:string" use="required"/>
                                            <xs:attribute name="type" type="xs:string" use="optional"/>
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="positionType" type="xs:string" use="optional"/>
            <xs:attribute name="templateID" type="xs:string" use="optional"/>
            <xs:attribute name="time" type="xs:double" use="optional"/>
            <xs:attribute name="preserve" type="xs:string" use="optional"/>
            <xs:attribute name="uniqueID" type="xs:string" use="optional"/>
            <xs:attribute name="autoCreationSourceUniqueID" type="xs:string" use="optional"/>
            <xs:attribute name="version" type="xs:string" use="optional"/>
            <xs:attribute name="name" type="xs:string" use="optional"/>
        </xs:complexType>
    </xs:element>

    <!-- Legacy action type (deprecated, use 'action' instead) -->
    <xs:element name="actionType">
        <xs:annotation>
            <xs:documentation>
                DEPRECATED: Legacy action format. Use 'action' element instead.
                This element is maintained for backward compatibility only.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:simpleContent>
                <xs:restriction base="xs:anyType">
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:minLength value="1"/>
                        </xs:restriction>
                    </xs:simpleType>
                    <xs:attribute name="time" use="required" type="xs:decimal"/>
                    <xs:attribute name="parameter" use="required" type="xs:string"/>
                </xs:restriction>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>
    <!-- Defines a language -->
    <xs:simpleType name="languageType">
		<xs:annotation>
			<xs:documentation>
				WARNING: AUTO-MANAGED FIELD
				This field is automatically detected from the media file during validation.
				Do not manually set this value as it will be overwritten during validation.
			</xs:documentation>
		</xs:annotation>
        <xs:restriction base="xs:string">
            <xs:minLength value="2"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- Defines a closed-caption type -->
    <xs:simpleType name="captioningType">
		<xs:annotation>
			<xs:documentation>
				WARNING: AUTO-MANAGED FIELD
				This field is automatically detected from the media file during validation.
				Do not manually set this value as it will be overwritten during validation.
			</xs:documentation>
		</xs:annotation>
        <xs:restriction base="xs:integer">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="255"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- This is the main type: the document -->
    <xs:element name="playlistDocument">
        <xs:annotation>
            <xs:documentation>
                Playlist Document Root Element

                This is the root element of an OnTheAir Video playlist document.
                It contains optional playlist-level settings and one or more playlist items.

                Attributes:
                - version: Schema version number (currently 4.0). Required.

                Children:
                - settings: Optional playlist-level settings (loop, chain, cue, etc.)
                - playlistItem: One or more media items (required, unbounded)

                Constraints:
                - Each playlistItem must have a unique uniqueID within the document
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="settings" minOccurs="0" maxOccurs="1"/>
                <xs:element maxOccurs="unbounded" ref="playlistItem"/>
            </xs:sequence>
            <xs:attribute name="version" use="required" type="xs:decimal"/>
            <xs:anyAttribute namespace="##other" processContents="lax"/>
        </xs:complexType>
		<xs:unique name="unique-uniqueID">
		  <xs:selector xpath="playlistItem"/>
		  <xs:field xpath="uniqueID"/>
		</xs:unique>
    </xs:element>
    <xs:element name="settings">
        <xs:annotation>
            <xs:documentation>
                Playlist Settings

                Contains playlist-level configuration that applies to the entire playlist.
                All settings are optional and have default values if omitted.

                Settings include:
                - loop: Auto-loop playlist when it reaches the end
                - chain: Chain items together (seamless playback)
                - cue: Enable cue mode
                - showThumbnails: Display thumbnails in playlist
                - playerUniqueID: Associated player ID
                - presetDuration: Preset duration for items
                - theoreticalStartDateTime: Scheduled start time
                - shuffle: Randomize playback order
                - folderBasedPath: Base path for relative file references
                - importedFromTraffic: Flag indicating traffic system import
                - leftCounterMode/rightCounterMode: Counter display modes
                - windowRectangle: Saved window position and size
                - MIDIEquivalents: MIDI control mappings
                - uniqueID: Unique identifier for the playlist
                - MOSGenerated: Flag indicating MOS traffic system generation
                - originalFormat: Original format of the playlist
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="1" ref="loop"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="chain"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="cue"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="showThumbnails"/>
                <xs:element minOccurs="0" maxOccurs="1" name="uniqueID" type="xs:string"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="playerUniqueID"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="presetDuration"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="importedFromTraffic"/>
                <xs:element minOccurs="0" maxOccurs="1" name="MOSGenerated" type="xs:boolean"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="folderBasedPath"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="shuffle"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="leftCounterMode"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="rightCounterMode"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="windowRectangle"/>
				<xs:element minOccurs="0" maxOccurs="1" ref="theoreticalStartDateTime"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="MIDIEquivalents"/>
                <xs:element minOccurs="0" maxOccurs="1" name="originalFormat" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="loop" type="xs:boolean"/>
    <xs:element name="chain" type="xs:boolean"/>
    <xs:element name="cue" type="xs:boolean"/>
    <xs:element name="showThumbnails" type="xs:boolean"/>
	<xs:element name="presetDuration" type="xs:decimal"/>
	<xs:element name="theoreticalStartDateTime" type="xs:string"/>
    <xs:element name="shuffle" type="xs:boolean"/>
	<xs:element name="folderBasedPath" type="xs:string"/>
	<xs:element name="importedFromTraffic" type="xs:boolean"/>
    <xs:element name="leftCounterMode" type="counterModeType"/>
    <xs:element name="rightCounterMode" type="counterModeType"/>
    <xs:element name="MIDIEquivalents">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element minOccurs="0" maxOccurs="1" name="stop" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="alphaKey" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="play" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="pause" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="skipToNext" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="skipToPrevious" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="loop" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="cue" type="MIDINoteElement"/>
                <xs:element minOccurs="0" maxOccurs="1" name="chain" type="MIDINoteElement"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="windowRectangle">
        <xs:complexType>
            <xs:attribute name="x" use="required" type="xs:decimal"/>
            <xs:attribute name="y" use="required" type="xs:decimal"/>
            <xs:attribute name="height" use="required" type="xs:decimal"/>
            <xs:attribute name="width" use="required" type="xs:decimal"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="playlistItem">
        <xs:annotation>
            <xs:documentation>
                Playlist Item Element

                Represents a single item in an OnTheAir Video playlist. Each item can reference either:
                - A media file via mediaFilePath (traditional file-based workflow)
                - A Media Browser item via mediaBrowserItemUniqueID (database-based workflow)

                MANDATORY FIELDS:
                - uniqueID: Always required. Unique identifier for this playlist item.

                CONDITIONAL MANDATORY FIELDS (depending on usage):
                When NOT using Media Browser (file-based):
                - mediaFilePath: Required. Full path to the media file.
                - displayName: Strongly recommended. Display name for the item.

                When using Media Browser (database-based):
                - mediaBrowserItemUniqueID: Required. Reference to Media Browser item.

                WARNING: AUTO-MANAGED FIELDS
                The following fields are automatically set/updated by OnTheAir Video during validation
                and playback. Do NOT manually set these fields as they will be overwritten:
                - validationStatus: Set during media validation
                - videoCodecDescription: Detected from media file
                - audioCodecDescription: Detected from media file
                - fileDurationInSeconds: Detected from media file
                - fileLastModificationDate: File system timestamp
                - framesPerSecond: Detected from media file
                - dropFrame: Detected from media file
                - isStillImage: Detected from media file
                - isSoundFile: Detected from media file
                - mediaFileDisplaySize: Detected from media file
                - firstFrameNumber: Detected from media file
                - availableAudioLanguages: Detected from media file
                - availableCaptioningTypes: Detected from media file
                - validationErrorReason: Set when validation fails
                - nextItemMixPointInSeconds: Calculated during playback
                - previousItemMixPointInSeconds: Calculated during playback
                - durationInSeconds: Calculated from in/out points
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <!-- Order matches XMLElementWithThumbnail method in PlaylistItem.m -->
                <xs:element ref="uniqueID" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="mediaFilePath" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="remoteItemLastModificationDate" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="displayName" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="filename" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="externalItemURL" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="mediaBrowserItemUniqueID" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="remoteItemURL" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isComment" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="isDisabled" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isOffline" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isVirtualClip" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="logoFilename" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="logoIsEnabled" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isLiveClip" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isStreamClip" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="reverseFieldOrder" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="shouldPremultiplyByAlpha" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="videoCodecDescription" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="audioCodecDescription" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="startTransitionName" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="startTransitionDuration" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="startTransitionNonChainedAddedDuration" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="startTransitionChainedAddedDuration" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="playbackMode" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="finderLabelIndex" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="finderLabelDescription" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="actions" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="userMetadata" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="mosMetadata" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="audioCrosspoints" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="EPGTagUniqueID" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="validationStatus" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="validationErrorReason" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="resizeMode" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="resizeModeOption" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="mediaFileDisplaySize" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="displayRect" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="fileLastModificationDate" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="fileDurationInSeconds" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="firstFrameNumber" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="framesPerSecond" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="dropFrame" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="inPointInSeconds" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="outPointInSeconds" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="previousItemMixPointInSeconds" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="nextItemMixPointInSeconds" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="durationInSeconds" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="inputMIDIMessage" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="outputMIDIMessage" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="audioVolume" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="availableAudioLanguages" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="availableCaptioningTypes" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isStillImage" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isSoundFile" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="thumbnailData" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="itemCGProjects" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="timedStartDateTime" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="timedStartRepeatsDaily" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="timedStartTriggerPlayback" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="demuxingOptions" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="theoreticalDuration" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="theoreticalAbsoluteStartTime" minOccurs="0" maxOccurs="1"/>
 				<xs:element ref="segmentNumber" minOccurs="0" maxOccurs="1"/>
 				<xs:element ref="segmentType" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="reconciliationID" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="ISCICode" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="rating" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="BXFFilename" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="virtualSourceUniqueID" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="contentType" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="nextClipTriggerGPIInput" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="includeInAutoCheck" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="metadata" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="itemPathValue" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="isStreamed" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="streamProtocol" minOccurs="0" maxOccurs="1"/>
                <!-- Legacy MIDI elements kept for backward compatibility -->
                <xs:element ref="inputMIDINote" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="outputMIDINote" minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="mediaFilePath" type="stringWithSpaces"/>
    <xs:element name="mediaBrowserItemUniqueID" type="stringWithSpaces"/>
    <xs:element name="filename" type="stringWithSpaces"/>
    <xs:element name="reconciliationID" type="stringWithSpaces"/>
    <xs:element name="ISCICode" type="stringWithSpaces"/>
    <xs:element name="BXFFilename" type="stringWithSpaces"/>
    <xs:element name="displayName" type="stringWithSpaces"/>
    <xs:element name="playbackMode" type="playbackModeType"/>
    <xs:element name="finderLabelIndex">
        <xs:simpleType>
            <xs:restriction base="xs:integer">
                <xs:minInclusive value="0"/>
                <xs:maxInclusive value="7"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="actions">
        <xs:annotation>
            <xs:documentation>
                Actions Container

                Contains all actions for this playlist item.
                Supports both modern 'action' elements and legacy 'actionType' elements.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="action"/>
                <xs:element ref="actionType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="itemCGProjects">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="itemCGProject"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="itemCGProject">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="1" maxOccurs="1" ref="projectName"/>
                <xs:element minOccurs="1" maxOccurs="1" ref="shouldRun"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="itemValues"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
	<xs:element name="projectName" type="stringWithSpaces"/>
	<xs:element name="shouldRun" type="xs:boolean"/>
    <xs:element name="itemValues">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="itemValue"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="itemValue">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="1" maxOccurs="1" ref="itemName"/>
                <xs:element minOccurs="1" maxOccurs="1" ref="itemStringValue"/>
                <xs:element minOccurs="1" maxOccurs="1" ref="itemDefaultValue"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
	<xs:element name="itemName" type="stringWithSpaces"/>
	<xs:element name="itemDefaultValue" type="stringWithSpaces"/>
	<xs:element name="itemStringValue" type="stringWithSpaces"/>
    <xs:element name="videoCodecDescription">
        <xs:annotation>
            <xs:documentation>
                Video Codec Description

                WARNING: AUTO-MANAGED FIELD
                This field is automatically populated by OnTheAir Video during media validation.
                It contains a human-readable description of the video codec (e.g., "H.264", "ProRes 422").
                Do not manually set this value as it will be overwritten during validation.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="audioCodecDescription">
        <xs:annotation>
            <xs:documentation>
                Audio Codec Description

                WARNING: AUTO-MANAGED FIELD
                This field is automatically populated by OnTheAir Video during media validation.
                It contains a human-readable description of the audio codec (e.g., "AAC", "PCM").
                Do not manually set this value as it will be overwritten during validation.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string"/>
        </xs:simpleType>
    </xs:element>
	<xs:element name="theoreticalDuration" type="xs:double"/>
	<xs:element name="theoreticalAbsoluteStartTime" type="xs:double"/>
	<xs:element name="timedStartDateTime" type="xs:string"/>
	<xs:element name="timedStartRepeatsDaily" type="xs:boolean"/>
	<xs:element name="timedStartTriggerPlayback" type="xs:boolean"/>
	<xs:element name="startTransitionName">
        <xs:annotation>
            <xs:documentation>
                Start Transition Name

                Specifies the transition effect to use when this item starts playing.
                Leave empty for no transition (hard cut).

                BUILT-IN TRANSITIONS (39 total):

                Dissolve Transitions:
                - Dissolve
                - DipToBlack
                - DipToWhite

                Push Transitions:
                - PushLeft
                - PushRight
                - PushUp
                - PushDown

                Slide Transitions:
                - SlideLeft
                - SlideRight
                - SlideUp
                - SlideDown

                Wipe Transitions:
                - WipeLeft
                - WipeRight
                - WipeUp
                - WipeDown

                Reveal Transitions:
                - RevealLeft
                - RevealRight
                - RevealUp
                - RevealDown

                Special Wipes:
                - WipeClock
                - WipeIris
                - WipeBand
                - WipeLeftThenRight

                Zoom Transitions:
                - ZoomIn
                - ZoomOut

                Page Turn Transitions:
                - PageCurlLeft
                - PageCurlRight

                Swap Transitions:
                - SwapLeft
                - SwapRight
                - SwapUp
                - SwapDown

                Cube Transitions:
                - CubeLeft
                - CubeRight
                - CubeUp
                - CubeDown

                Flip Transitions:
                - FlipLeft
                - FlipRight

                CUSTOM TRANSITIONS:
                You can also specify custom transition names that have been created
                in OnTheAir Video's transition editor. Custom transition names are
                case-sensitive and must match exactly.

                Note: Transition availability may depend on your graphics card and
                OnTheAir Video version.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="startTransitionDuration" type="xs:double"/>
    <xs:element name="validationStatus" type="validationStatusType"/>
    <xs:element name="validationErrorReason" type="xs:string"/>
    <xs:element name="finderLabelDescription" type="xs:string"/>
    <xs:element name="dropFrame" type="xs:boolean"/>
    <xs:element name="resizeMode" type="resizeModeType"/>
    <xs:element name="isStillImage" type="xs:boolean"/>
    <xs:element name="isSoundFile" type="xs:boolean"/>
    <xs:element name="isComment" type="xs:boolean"/>
	<xs:element name="isDisabled" type="xs:boolean"/>
    <xs:element name="isStreamClip" type="xs:boolean"/>
    <xs:element name="segmentNumber" type="xs:decimal"/>
    <xs:element name="segmentType" type="xs:string"/>
	<xs:element name="nextClipTriggerGPIInput" type="xs:decimal"/>
	<xs:element name="includeInAutoCheck" type="xs:boolean"/>
    <xs:element name="logoIsEnabled" type="xs:boolean"/>
    <xs:element name="logoFilename" type="stringWithSpaces"/>
    <xs:element name="isLiveClip" type="xs:boolean"/>
    <xs:element name="reverseFieldOrder" type="xs:boolean"/>
	<xs:element name="shouldPremultiplyByAlpha" type="xs:boolean"/>
    <xs:element name="inputMIDINote" type="MIDINoteElement"/>
    <xs:element name="outputMIDINote" type="MIDINoteElement"/>
    <xs:element name="mediaFileDisplaySize">
        <xs:complexType>
            <xs:attribute name="height" use="required" type="xs:decimal"/>
            <xs:attribute name="width" use="required" type="xs:decimal"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="displayRect">
        <xs:complexType>
            <xs:attribute name="height" use="required" type="xs:decimal"/>
            <xs:attribute name="width" use="required" type="xs:decimal"/>
            <xs:attribute name="x" use="required" type="xs:decimal"/>
            <xs:attribute name="y" use="required" type="xs:decimal"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="fileLastModificationDate">
        <xs:annotation>
            <xs:documentation>
                File Last Modification Date

                WARNING: AUTO-MANAGED FIELD
                This field is automatically set from the file system's modification timestamp.
                Do not manually set this value as it will be overwritten during validation.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="fileDurationInSeconds">
        <xs:annotation>
            <xs:documentation>
                File Duration In Seconds
				Represents the total duration of the media file in seconds.
				
                WARNING: AUTO-MANAGED FIELD
                This field is automatically detected from the media file during validation.
                Do not manually set this value as it will be overwritten during validation.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:double"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="relativeStartTimeInSeconds" type="xs:double"/>
	<xs:element name="firstFrameNumber">
        <xs:annotation>
            <xs:documentation>
                First Frame Number
				Represents the starting frame number/timecode of the media.
				
                WARNING: AUTO-MANAGED FIELD
                This field is automatically detected from the media file's timecode track.
                Do not manually set this value as it will be overwritten during validation.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:decimal"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="framesPerSecond">
        <xs:annotation>
            <xs:documentation>
                Frames Per Second
				Represents the frame rate (e.g., 25.0, 29.97, 59.94).
				
                WARNING: AUTO-MANAGED FIELD
                This field is automatically detected from the media file during validation.
                Do not manually set this value as it will be overwritten during validation.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:double"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="durationInSeconds">
		<xs:annotation>
			<xs:documentation>
				Duration In Seconds
				Represents the playback duration: (outPoint - inPoint).
			</xs:documentation>
		</xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:double"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="inPointInSeconds" type="xs:double"/>
    <xs:element name="outPointInSeconds" type="xs:double"/>
	<xs:element name="previousItemMixPointInSeconds">
        <xs:annotation>
            <xs:documentation>
                Previous Item Mix Point In Seconds
                Represents where this item begins mixing with the previous item.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:double"/>
        </xs:simpleType>
    </xs:element>
	<xs:element name="nextItemMixPointInSeconds">
        <xs:annotation>
            <xs:documentation>
                Next Item Mix Point In Seconds
                Represents where this item begins mixing with the next item.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:double"/>
        </xs:simpleType>
    </xs:element>
    <xs:element name="audioVolume">
        <xs:simpleType>
            <xs:restriction base="xs:double">
                <xs:minInclusive value="-1.0"/>
                <xs:maxInclusive value="2.0"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="availableAudioLanguages">
		<xs:annotation>
			<xs:documentation>
				Shows which audio languages are present in the file
				Represents where this item begins mixing with the next item.
				
				WARNING: AUTO-MANAGED FIELD
				This field is automatically detected from the media file during validation.
				Do not manually set this value as it will be overwritten during validation.
			</xs:documentation>
		</xs:annotation>
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element minOccurs="0" maxOccurs="unbounded" name="language" type="languageType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="availableCaptioningTypes">
		<xs:annotation>
			<xs:documentation>
				WARNING: AUTO-MANAGED FIELD
				This field is automatically detected from the media file during validation.
				Do not manually set this value as it will be overwritten during validation.
			</xs:documentation>
		</xs:annotation>
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element minOccurs="0" maxOccurs="unbounded" name="type" type="captioningType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="availableSubtitleLanguages">
		<xs:annotation>
			<xs:documentation>
				WARNING: AUTO-MANAGED FIELD
				This field is automatically detected from the media file during validation.
				Do not manually set this value as it will be overwritten during validation.
			</xs:documentation>
		</xs:annotation>
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element minOccurs="0" maxOccurs="unbounded" name="language" type="languageType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="thumbnailData" type="xs:string"/>
    <xs:element name="metadata">
		<xs:annotation>
			<xs:documentation>
				Metadata Container

				Contains key-value pairs of metadata extracted from the media file or set by the user.

				WARNING: AUTO-MANAGED FIELD
				This field is automatically detected from the media file during validation.
				Do not manually set this value as it will be overwritten during validation.
			</xs:documentation>
		</xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="uniqueID" type="xs:string"/>
    <xs:element name="playerUniqueID" type="xs:string"/>
    <xs:element name="isVirtualClip" type="xs:boolean"/>
    <xs:element name="startTransitionNonChainedAddedDuration" type="xs:double"/>
    <xs:element name="startTransitionChainedAddedDuration" type="xs:double"/>
    <xs:element name="resizeModeOption" type="resizeModeOptionType"/>
    <xs:element name="EPGTagUniqueID" type="xs:string"/>
    <xs:element name="rating" type="xs:string"/>
    <xs:element name="virtualSourceUniqueID" type="xs:string"/>
    <xs:element name="contentType" type="xs:string"/>
    <xs:element name="remoteItemLastModificationDate" type="xs:string"/>
    <xs:element name="externalItemURL" type="stringWithSpaces"/>
    <xs:element name="remoteItemURL" type="stringWithSpaces"/>
    <xs:element name="isOffline" type="xs:boolean"/>
    <xs:element name="inputMIDIMessage" type="MIDINoteElement"/>
    <xs:element name="outputMIDIMessage" type="MIDINoteElement"/>
    <xs:element name="itemPathValue" type="stringWithSpaces"/>
    <xs:element name="isStreamed" type="xs:boolean"/>
    <xs:element name="streamProtocol" type="xs:string"/>
    <xs:element name="mosMetadata">
        <xs:complexType>
            <xs:sequence>
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="audioCrosspoints">
        <xs:complexType>
            <xs:sequence>
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="userMetadata">
        <xs:complexType>
            <xs:sequence>
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="demuxingOptions">
        <xs:complexType>
            <xs:sequence>
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
