<?xml version="1.0"?>
<!--
  Q Light Controller Plus
  fixture.xsd

  Copyright (C) Jano Svitok

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0.txt

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.


  XML Schema for Fixture Definitions

  usage (from fixtures dir, replace "_" with "-"):

    xmllint __noout __schema ../schemas/fixture.xsd *.qxf

  xmllint is part of libxml2-utils package in ubuntu.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.qlcplus.org/FixtureDefinition"
xmlns="http://www.qlcplus.org/FixtureDefinition"
elementFormDefault="qualified"
>

<xs:element name="FixtureDefinition">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Creator" type="creatorType"/>
            <xs:element name="Manufacturer" type="xs:string"/>
            <xs:element name="Model" type="xs:string"/>
            <xs:element name="Type" type="typeType"/>
            <xs:element name="Channel" type="channelType" maxOccurs="unbounded"/>
            <xs:element name="Mode" type="modeType" maxOccurs="unbounded"/>
            <xs:element name="Physical" type="physicalType" minOccurs="0"/>
        </xs:sequence>
     </xs:complexType>
</xs:element>

<xs:complexType name="creatorType">
    <xs:sequence>
        <xs:element name="Name" type="xs:string"/>
        <xs:element name="Version" type="xs:string"/>
        <xs:element name="Author" type="xs:string"/>
    </xs:sequence>
</xs:complexType>

<xs:simpleType name="typeType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="Color Changer"/>
        <xs:enumeration value="Dimmer"/>
        <xs:enumeration value="Effect"/>
        <xs:enumeration value="Fan"/>
        <xs:enumeration value="Flower"/>
        <xs:enumeration value="Hazer"/>
        <xs:enumeration value="Laser"/>
        <xs:enumeration value="Moving Head"/>
        <xs:enumeration value="Other"/>
        <xs:enumeration value="Scanner"/>
        <xs:enumeration value="Smoke"/>
        <xs:enumeration value="Strobe"/>
        <xs:enumeration value="LED Bar (Beams)"/>
        <xs:enumeration value="LED Bar (Pixels)"/>
    </xs:restriction>
</xs:simpleType>

<xs:complexType name="channelType">
    <xs:sequence>
        <xs:element name="Group" type="groupType" minOccurs="0"/>
        <xs:element name="Colour" type="colorType" minOccurs="0"/>
        <xs:element name="Capability" type="capabilityType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Name" type="xs:string" use="required"/>
    <xs:attribute name="Default" type="dmxValueType"/>
    <xs:attribute name="Preset" type="channelPresetType"/>
</xs:complexType>

<xs:complexType name="groupType">
    <xs:simpleContent>
        <xs:extension base="groupEnumType">
            <xs:attribute name="Byte" type="groupByteType" use="required"/>
        </xs:extension>
     </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="groupEnumType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Intensity"/>
            <xs:enumeration value="Colour"/>
            <xs:enumeration value="Gobo"/>
            <xs:enumeration value="Prism"/>
            <xs:enumeration value="Shutter"/>
            <xs:enumeration value="Beam"/>
            <xs:enumeration value="Speed"/>
            <xs:enumeration value="Effect"/>
            <xs:enumeration value="Pan"/>
            <xs:enumeration value="Tilt"/>
            <xs:enumeration value="Maintenance"/>
            <xs:enumeration value="Nothing"/>
        </xs:restriction>
</xs:simpleType>

<xs:simpleType name="groupByteType">
    <xs:restriction base="xs:nonNegativeInteger">
        <xs:minInclusive value="0"/>
        <xs:maxInclusive value="1"/>
    </xs:restriction>
</xs:simpleType>

<xs:simpleType name="colorType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="Generic"/>
        <xs:enumeration value="Red"/>
        <xs:enumeration value="Green"/>
        <xs:enumeration value="Blue"/>
        <xs:enumeration value="Cyan"/>
        <xs:enumeration value="Magenta"/>
        <xs:enumeration value="Yellow"/>
        <xs:enumeration value="Amber"/>
        <xs:enumeration value="White"/>
        <xs:enumeration value="UV"/>
        <xs:enumeration value="Lime"/>
        <xs:enumeration value="Indigo"/>
    </xs:restriction>
</xs:simpleType>


<xs:complexType name="capabilityType" mixed="true">
   <xs:sequence>
      <xs:element name="Alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
   </xs:sequence>
   <xs:attribute name="Min" type="dmxValueType" use="required"/>
   <xs:attribute name="Max" type="dmxValueType" use="required"/>
   <xs:attribute name="Preset" type="capabilityPresetType"/>
   <xs:attribute name="Res1" type="xs:string"/>
   <xs:attribute name="Res2" type="xs:string"/>
   <xs:attribute name="Res" type="xs:string"/>
   <xs:attribute name="Color" type="xs:string"/>
   <xs:attribute name="Color2" type="xs:string"/>
</xs:complexType>

<!-- please see
https://github.com/mcallegari/qlcplus/wiki/Fixture-definition-presets
when changing this list -->
<xs:simpleType name="channelPresetType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="IntensityMasterDimmer"/>
        <xs:enumeration value="IntensityMasterDimmerFine"/>
        <xs:enumeration value="IntensityDimmer"/>
        <xs:enumeration value="IntensityDimmerFine"/>
        <xs:enumeration value="IntensityRed"/>
        <xs:enumeration value="IntensityRedFine"/>
        <xs:enumeration value="IntensityGreen"/>
        <xs:enumeration value="IntensityGreenFine"/>
        <xs:enumeration value="IntensityBlue"/>
        <xs:enumeration value="IntensityBlueFine"/>
        <xs:enumeration value="IntensityCyan"/>
        <xs:enumeration value="IntensityCyanFine"/>
        <xs:enumeration value="IntensityMagenta"/>
        <xs:enumeration value="IntensityMagentaFine"/>
        <xs:enumeration value="IntensityYellow"/>
        <xs:enumeration value="IntensityYellowFine"/>
        <xs:enumeration value="IntensityAmber"/>
        <xs:enumeration value="IntensityAmberFine"/>
        <xs:enumeration value="IntensityWhite"/>
        <xs:enumeration value="IntensityWhiteFine"/>
        <xs:enumeration value="IntensityUV"/>
        <xs:enumeration value="IntensityUVFine"/>
        <xs:enumeration value="IntensityIndigo"/>
        <xs:enumeration value="IntensityIndigoFine"/>
        <xs:enumeration value="IntensityLime"/>
        <xs:enumeration value="IntensityLimeFine"/>
        <xs:enumeration value="IntensityHue"/>
        <xs:enumeration value="IntensityHueFine"/>
        <xs:enumeration value="IntensitySaturation"/>
        <xs:enumeration value="IntensitySaturationFine"/>
        <xs:enumeration value="IntensityLightness"/>
        <xs:enumeration value="IntensityLightnessFine"/>
        <xs:enumeration value="IntensityValue"/>
        <xs:enumeration value="IntensityValueFine"/>
        <xs:enumeration value="PositionPan"/>
        <xs:enumeration value="PositionPanFine"/>
        <xs:enumeration value="PositionTilt"/>
        <xs:enumeration value="PositionTiltFine"/>
        <xs:enumeration value="PositionXAxis"/>
        <xs:enumeration value="PositionYAxis"/>
        <xs:enumeration value="SpeedPanSlowFast"/>
        <xs:enumeration value="SpeedPanFastSlow"/>
        <xs:enumeration value="SpeedTiltSlowFast"/>
        <xs:enumeration value="SpeedTiltFastSlow"/>
        <xs:enumeration value="SpeedPanTiltSlowFast"/>
        <xs:enumeration value="SpeedPanTiltFastSlow"/>
        <xs:enumeration value="ColorMacro"/>
        <xs:enumeration value="ColorWheel"/>
        <xs:enumeration value="ColorWheelFine"/>
        <xs:enumeration value="ColorRGBMixer"/>
        <xs:enumeration value="ColorCTOMixer"/>
        <xs:enumeration value="ColorCTCMixer"/>
        <xs:enumeration value="ColorCTBMixer"/>
        <xs:enumeration value="GoboWheel"/>
        <xs:enumeration value="GoboWheelFine"/>
        <xs:enumeration value="GoboIndex"/>
        <xs:enumeration value="GoboIndexFine"/>
        <xs:enumeration value="ShutterStrobeSlowFast"/>
        <xs:enumeration value="ShutterStrobeFastSlow"/>
        <xs:enumeration value="ShutterIrisMinToMax"/>
        <xs:enumeration value="ShutterIrisMaxToMin"/>
        <xs:enumeration value="ShutterIrisFine"/>
        <xs:enumeration value="BeamFocusNearFar"/>
        <xs:enumeration value="BeamFocusFarNear"/>
        <xs:enumeration value="BeamFocusFine"/>
        <xs:enumeration value="BeamZoomSmallBig"/>
        <xs:enumeration value="BeamZoomBigSmall"/>
        <xs:enumeration value="BeamZoomFine"/>
        <xs:enumeration value="PrismRotationSlowFast"/>
        <xs:enumeration value="PrismRotationFastSlow"/>
        <xs:enumeration value="NoFunction"/>
    </xs:restriction>
</xs:simpleType>

<!-- please see
https://github.com/mcallegari/qlcplus/wiki/Fixture-definition-presets
when changing this list -->
<xs:simpleType name="capabilityPresetType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="SlowToFast" />
        <xs:enumeration value="FastToSlow" />
        <xs:enumeration value="NearToFar" />
        <xs:enumeration value="FarToNear" />
        <xs:enumeration value="BigToSmall" />
        <xs:enumeration value="SmallToBig" />
        <xs:enumeration value="ShutterOpen" />
        <xs:enumeration value="ShutterClose" />
        <xs:enumeration value="StrobeSlowToFast" />
        <xs:enumeration value="StrobeFastToSlow" />
        <xs:enumeration value="StrobeRandom" />
        <xs:enumeration value="StrobeRandomSlowToFast" />
        <xs:enumeration value="StrobeRandomFastToSlow" />
        <xs:enumeration value="PulseSlowToFast" />
        <xs:enumeration value="PulseFastToSlow" />
        <xs:enumeration value="RampUpSlowToFast" />
        <xs:enumeration value="RampUpFastToSlow" />
        <xs:enumeration value="RampDownSlowToFast" />
        <xs:enumeration value="RampDownFastToSlow" />
        <xs:enumeration value="StrobeFrequency" />
        <xs:enumeration value="StrobeFreqRange" />
        <xs:enumeration value="PulseFrequency" />
        <xs:enumeration value="PulseFreqRange" />
        <xs:enumeration value="RampUpFrequency" />
        <xs:enumeration value="RampUpFreqRange" />
        <xs:enumeration value="RampDownFrequency" />
        <xs:enumeration value="RampDownFreqRange" />
        <xs:enumeration value="RotationStop" />
        <xs:enumeration value="RotationIndexed" />
        <xs:enumeration value="RotationClockwise" />
        <xs:enumeration value="RotationClockwiseSlowToFast" />
        <xs:enumeration value="RotationClockwiseFastToSlow" />
        <xs:enumeration value="RotationCounterClockwise" />
        <xs:enumeration value="RotationCounterClockwiseSlowToFast" />
        <xs:enumeration value="RotationCounterClockwiseFastToSlow" />
        <xs:enumeration value="ColorMacro" />
        <xs:enumeration value="ColorDoubleMacro" />
        <xs:enumeration value="ColorWheelIndex" />
        <xs:enumeration value="GoboMacro" />
        <xs:enumeration value="GoboShakeMacro" />
        <xs:enumeration value="GenericPicture" />
        <xs:enumeration value="PrismEffectOn" />
        <xs:enumeration value="PrismEffectOff" />
        <xs:enumeration value="LampOn" />
        <xs:enumeration value="LampOff" />
        <xs:enumeration value="ResetAll" />
        <xs:enumeration value="ResetPanTilt" />
        <xs:enumeration value="ResetPan" />
        <xs:enumeration value="ResetTilt" />
        <xs:enumeration value="ResetMotors" />
        <xs:enumeration value="ResetGobo" />
        <xs:enumeration value="ResetColor" />
        <xs:enumeration value="ResetCMY" />
        <xs:enumeration value="ResetCTO" />
        <xs:enumeration value="ResetEffects" />
        <xs:enumeration value="ResetPrism" />
        <xs:enumeration value="ResetBlades" />
        <xs:enumeration value="ResetIris" />
        <xs:enumeration value="ResetFrost" />
        <xs:enumeration value="ResetZoom" />
        <xs:enumeration value="SilentModeOn" />
        <xs:enumeration value="SilentModeOff" />
        <xs:enumeration value="SilentModeAutomatic" />
        <xs:enumeration value="Alias" />
    </xs:restriction>
</xs:simpleType>

<xs:complexType name="aliasType">
    <xs:attribute name="Mode" type="xs:string" use="required"/>
    <xs:attribute name="Channel" type="xs:string" use="required"/>
    <xs:attribute name="With" type="xs:string" use="required"/>
</xs:complexType>

<xs:simpleType name="dmxValueType">
    <xs:restriction base="xs:nonNegativeInteger">
        <xs:minInclusive value="0"/>
        <xs:maxInclusive value="255" />
    </xs:restriction>
</xs:simpleType>

<xs:complexType name="modeType">
    <xs:sequence>
        <xs:element name="Physical" type="physicalType" minOccurs="0" />
        <xs:element name="Channel" type="modeChannelType" maxOccurs="unbounded" />
        <xs:element name="Head" type="headType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Name" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="physicalType">
    <xs:sequence>
        <xs:element name="Bulb" type="bulbType"/>
        <xs:element name="Dimensions" type="dimensionsType"/>
        <xs:element name="Lens" type="lensType"/>
        <xs:element name="Focus" type="focusType"/>
        <xs:element name="Layout" type="layoutType" minOccurs="0"/>
        <xs:element name="Technical" type="technicalType" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

<xs:complexType name="bulbType">
    <xs:attribute name="Lumens" type="xs:nonNegativeInteger" use="required"/>
    <xs:attribute name="Type" type="xs:string" use="required"/>
    <xs:attribute name="ColourTemperature" type="xs:nonNegativeInteger" use="required"/>
</xs:complexType>

<xs:simpleType name="weightType">
    <xs:restriction base="xs:decimal">
        <xs:minExclusive value="0"/>
    </xs:restriction>
</xs:simpleType>

<xs:complexType name="dimensionsType">
    <xs:attribute name="Width" type="xs:positiveInteger" use="required"/>
    <xs:attribute name="Height" type="xs:positiveInteger" use="required"/>
    <xs:attribute name="Depth" type="xs:positiveInteger" use="required"/>
    <xs:attribute name="Weight" type="weightType" use="required"/>
</xs:complexType>

<xs:complexType name="lensType">
    <xs:attribute name="Name" type="xs:string" use="required"/>
    <xs:attribute name="DegreesMin" type="xs:decimal" use="required"/>
    <xs:attribute name="DegreesMax" type="xs:decimal" use="required"/>
    <xs:attribute name="PrismFaces" type="xs:positiveInteger"/>
</xs:complexType>

<xs:complexType name="layoutType">
    <xs:attribute name="Width" type="xs:positiveInteger"/>
    <xs:attribute name="Height" type="xs:positiveInteger"/>
</xs:complexType>

<xs:complexType name="focusType">
    <xs:attribute name="Type" type="xs:string" use="required"/>
    <xs:attribute name="PanMax" type="xs:nonNegativeInteger" use="required"/>
    <xs:attribute name="TiltMax" type="xs:nonNegativeInteger" use="required"/>
</xs:complexType>

<xs:complexType name="technicalType">
    <xs:attribute name="PowerConsumption" type="xs:nonNegativeInteger" use="required"/>
    <xs:attribute name="DmxConnector" type="connectorType" use="required"/>
</xs:complexType>

<xs:simpleType name="connectorType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="3-pin"/>
        <xs:enumeration value="5-pin"/>
        <xs:enumeration value="3-pin and 5-pin"/>
        <xs:enumeration value="3-pin IP65"/>
        <xs:enumeration value="5-pin IP65"/>
        <xs:enumeration value="3.5 mm stereo jack"/>
        <xs:enumeration value="Wireless"/>
        <xs:enumeration value="Other"/>
    </xs:restriction>
</xs:simpleType>

<xs:complexType name="modeChannelType">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="Number" type="xs:nonNegativeInteger" use="required"/>
            <xs:attribute name="ActsOn" type="xs:nonNegativeInteger" use="optional"/>
        </xs:extension>
     </xs:simpleContent>
</xs:complexType>

<xs:complexType name="headType">
    <xs:sequence>
        <xs:element name="Channel" type="xs:nonNegativeInteger" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>

</xs:schema>
