<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
  <xs:simpleType name="pluginTypeEnum">
    <xs:annotation>
      <xs:documentation>The possible plugin types.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Required">
        <xs:annotation>
          <xs:documentation>Indicates the plugin must be installed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Optional">
        <xs:annotation>
          <xs:documentation>Indicates the plugin is optional.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Recommended">
        <xs:annotation>
          <xs:documentation>Indicates the plugin is recommended for stability.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NotUsable">
        <xs:annotation>
          <xs:documentation>Indicates that using the plugin could result in instability (i.e., a prerequisite plugin is missing).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="CouldBeUsable">
        <xs:annotation>
          <xs:documentation>
            Indicates that using the plugin could result in instability if loaded
            with the currently active plugins (i.e., a prerequisite plugin is missing),
            but that the prerequisite plugin is installed, just not activated.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="pluginType">
    <xs:annotation>
      <xs:documentation>The type of a given plugin.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="name" use="required" type="pluginTypeEnum">
      <xs:annotation>
        <xs:documentation>The name of the plugin type.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="fileDependency">
    <xs:annotation>
      <xs:documentation>A mod upon which the type of a plugin depends.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="file" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The file of the mod upon which a the plugin depends.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="state" use="required">
      <xs:annotation>
        <xs:documentation>The state of the mod file.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="Missing">
            <xs:annotation>
              <xs:documentation>Indicates the mod file is not installed.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="Inactive">
            <xs:annotation>
              <xs:documentation>Indicates the mod file is installed, but not active.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="Active">
            <xs:annotation>
              <xs:documentation>Indicates the mod file is installed and active.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="flagDependency">
    <xs:annotation>
      <xs:documentation>A condition flag upon which the type of a plugin depends.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="flag" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The name of the condition flag upon which a the plugin depends.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="value" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The value of the condition flag upon which a the plugin depends.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:group name="dependencyTypesGroup">
    <xs:annotation>
      <xs:documentation>The group of possible dependencies.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice maxOccurs="unbounded">
        <xs:element name="fileDependency" type="fileDependency" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>Specifies that a mod must be in a specified state.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="flagDependency" type="flagDependency" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>Specifies that a condition flag must have a specific value.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="gameDependency" type="versionDependency" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Specifies a minimum required version of the installed game.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="fommDependency" type="versionDependency" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Specifies a minimum required version of FOMM.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="dependencies" type="compositeDependency">
          <xs:annotation>
            <xs:documentation>A list of mods and their states against which to match the user's installation.</xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:complexType name="compositeDependency">
    <xs:annotation>
      <xs:documentation>A dependency that is made up of one or more dependencies.</xs:documentation>
    </xs:annotation>
    <xs:group ref="dependencyTypesGroup"/>
    <xs:attribute name="operator" default="And">
      <xs:annotation>
        <xs:documentation>The relation of the contained dependencies.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="And">
            <xs:annotation>
              <xs:documentation>Indicates all contained dependencies must be satisfied in order for this dependency to be satisfied.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="Or">
            <xs:annotation>
              <xs:documentation>Indicates at least one listed dependency must be satisfied in order for this dependency to be satisfied.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="dependencyPattern">
    <xs:annotation>
      <xs:documentation>A pattern of mod files and condition flags that determine the type of a plugin.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="dependencies" type="compositeDependency" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The list of mods and their states against which to match the user's installation.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="type" type="pluginType" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>The type of the plugin.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="dependencyPatternList">
    <xs:annotation>
      <xs:documentation>A list of dependency patterns.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="pattern" type="dependencyPattern" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>A specific pattern of mod files and condition flags against which to match the user's installation.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="dependencyPluginType">
    <xs:annotation>
      <xs:documentation>A plugin type that is dependent upon the state of other mods.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="defaultType" type="pluginType">
        <xs:annotation>
          <xs:documentation>The default type of the plugin used if none of the specified dependency states are satisfied.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="patterns" type="dependencyPatternList">
        <xs:annotation>
          <xs:documentation>The list of dependency patterns against which to match the user's installation. The first pattern that matches the user's installation determines the type of the plugin.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="pluginTypeDescriptor">
    <xs:annotation>
      <xs:documentation>Describes the type of a plugin.</xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element name="dependencyType" type="dependencyPluginType">
        <xs:annotation>
          <xs:documentation>Used when the plugin type is dependent upon the state of other mods.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="type" type="pluginType">
        <xs:annotation>
          <xs:documentation>The type of the plugin.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="image">
    <xs:annotation>
      <xs:documentation>An image.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="path" use="required">
      <xs:annotation>
        <xs:documentation>The path to the image in the FOMod.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="headerImage">
    <xs:annotation>
      <xs:documentation>An image.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="path" use="optional" type="xs:string">
      <xs:annotation>
        <xs:documentation>The path to the image in the FOMod. If omitted the FOMod's screenshot is used.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="showImage" type="xs:boolean" default="true" use="optional">
      <xs:annotation>
        <xs:documentation>Whether or not the image should be displayed.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="showFade" type="xs:boolean" default="true" use="optional">
      <xs:annotation>
        <xs:documentation>Whether or not the fade effect should be displayed. This value is ignored if showImage is false.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="height" type="xs:int" default="-1" use="optional">
      <xs:annotation>
        <xs:documentation>The height to use for the image. Note that there is a minimum height that is enforced based on the user's settings.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="plugin">
    <xs:annotation>
      <xs:documentation>A plugin.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="description" type="xs:string">
        <xs:annotation>
          <xs:documentation>A description of the plugin.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="image" type="image" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The optional image associated with a plugin.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:choice>
        <xs:sequence>
          <xs:element name="files" type="fileList">
            <xs:annotation>
              <xs:documentation>The list of files and folders that need to be installed for the plugin.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="conditionFlags" type="conditionFlagList" minOccurs="0">
            <xs:annotation>
              <xs:documentation>The list of condition flags to set if the plugin is in the appropriate state.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
        <xs:sequence>
          <xs:element name="conditionFlags" type="conditionFlagList">
            <xs:annotation>
              <xs:documentation>The list of condition flags to set if the plugin is in the appropriate state.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="files" type="fileList" minOccurs="0">
            <xs:annotation>
              <xs:documentation>The list of files and folders that need to be installed for the plugin.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:choice>
      <xs:element name="typeDescriptor" type="pluginTypeDescriptor" minOccurs="0">
        <xs:annotation>
          <xs:documentation>Describes the type of the plugin.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The name of the plugin.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:simpleType name="orderEnum">
    <xs:annotation>
      <xs:documentation>The possible orders of items.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Ascending">
        <xs:annotation>
          <xs:documentation>Indicates the items are to be ordered ascending alphabetically.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Descending">
        <xs:annotation>
          <xs:documentation>Indicates the items are to be ordered descending alphabetically.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Explicit">
        <xs:annotation>
          <xs:documentation>Indicates the items are to be ordered as listed in the configuration file.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="pluginList">
    <xs:annotation>
      <xs:documentation>A list of plugins.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="plugin" type="plugin" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>A mod plugin belonging to a group.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="order" type="orderEnum" use="optional" default="Ascending">
      <xs:annotation>
        <xs:documentation>The order by which to list the plugins.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="group">
    <xs:annotation>
      <xs:documentation>A group of plugins.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="plugins" type="pluginList">
        <xs:annotation>
          <xs:documentation>The list of plugins in the group.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The name of the group.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type" use="required">
      <xs:annotation>
        <xs:documentation>The type of the group.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="SelectAtLeastOne">
            <xs:annotation>
              <xs:documentation>At least one plugin in the group must be selected.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="SelectAtMostOne">
            <xs:annotation>
              <xs:documentation>At most one plugin in the group must be selected.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="SelectExactlyOne">
            <xs:annotation>
              <xs:documentation>Exactly one plugin in the group must be selected.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="SelectAll">
            <xs:annotation>
              <xs:documentation>All plugins in the group must be selected.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="SelectAny">
            <xs:annotation>
              <xs:documentation>Any number of plugins in the group may be selected.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="groupList">
    <xs:annotation>
      <xs:documentation>A list of plugin groups.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="group" type="group" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>A group of plugins for the mod.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="order" type="orderEnum" use="optional" default="Ascending">
      <xs:annotation>
        <xs:documentation>The order by which to list the groups.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="stepList">
    <xs:annotation>
      <xs:documentation>A list of install steps.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="installStep" type="installStep" minOccurs="1" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>A list of install steps for the mod.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="order" type="orderEnum" use="optional" default="Ascending">
      <xs:annotation>
        <xs:documentation>The order by which to list the steps.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="installStep">
    <xs:annotation>
      <xs:documentation>A step in the install process containing groups of optional plugins.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="visible" type="compositeDependency" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The pattern against which to match the conditional flags and installed files. If the pattern is matched, then the install step will be visible.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="optionalFileGroups" type="groupList" minOccurs="1">
        <xs:annotation>
          <xs:documentation>The list of optional files (or plugins) that may optionally be installed for this module.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The name of the install step.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="fileSystemItem">
    <xs:annotation>
      <xs:documentation>A file or folder that may be installed as part of a module or plugin.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="source" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The path to the file or folder in the FOMod.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="destination" type="xs:string">
      <xs:annotation>
        <xs:documentation>The path to which the file or folder should be installed. If omitted, the destination is the same as the source.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="alwaysInstall" type="xs:boolean" default="false">
      <xs:annotation>
        <xs:documentation>Indicates that the file or folder should always be installed, regardless of whether or not the plugin has been selected.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="installIfUsable" type="xs:boolean" default="false">
      <xs:annotation>
        <xs:documentation>Indicates that the file or folder should always be installed if the plugin is not NotUsable, regardless of whether or not the plugin has been selected.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="priority" type="xs:integer" default="0">
      <xs:annotation>
        <xs:documentation>A number describing the relative priority of the file or folder. A higher number indicates the file or folder should be installed after the items with lower numbers. This value does not have to be unique.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="fileList">
    <xs:annotation>
      <xs:documentation>A list of files and folders.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element name="file" type="fileSystemItem" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>A file belonging to the plugin or module.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="folder" type="fileSystemItem" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>A folder belonging to the plugin or module.</xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="setConditionFlag">
    <xs:annotation>
      <xs:documentation>A condition flag to set if a plugin is selected.</xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="name" type="xs:string" use="required">
          <xs:annotation>
            <xs:documentation>The identifying name of the condition flag.</xs:documentation>
          </xs:annotation>
        </xs:attribute>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="conditionFlagList">
    <xs:annotation>
      <xs:documentation>A list of condition flags to set if a plugin is in the appropriate state.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="flag" type="setConditionFlag" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>A condition flag to set if the plugin is selected.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="versionDependency">
    <xs:annotation>
      <xs:documentation>A required minimum version of an item.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="version" type=" xs:string" use="required">
      <xs:annotation>
        <xs:documentation>The required minimum version of the item.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="conditionalInstallPattern">
    <xs:annotation>
      <xs:documentation>A pattern of mod files and conditional flags that determine whether to instal specific files.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="dependencies" type="compositeDependency">
        <xs:annotation>
          <xs:documentation>The list of mods and their states against which to match the user's installation.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="files" type="fileList">
        <xs:annotation>
          <xs:documentation>The files and filders to install if the pattern is matched.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="conditionalInstallPatternList">
    <xs:annotation>
      <xs:documentation>A list of conditional install patterns.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="pattern" type="conditionalInstallPattern" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>A specific pattern of mod files and condition flags against which to match the user's installation.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="conditionalFileInstallList">
    <xs:annotation>
      <xs:documentation>A list of optional files that may optionally be installed for this module, base on condition flags.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="patterns" type="conditionalInstallPatternList">
        <xs:annotation>
          <xs:documentation>The list of patterns against which to match the conditional flags and installed files. All matching patterns will have their files installed.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="moduleTitle">
    <xs:annotation>
      <xs:documentation>Describes the display properties of the module title.</xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="position" use="optional" default="Left">
          <xs:annotation>
            <xs:documentation>The identifying name of the condition flag.</xs:documentation>
          </xs:annotation>
          <xs:simpleType>
            <xs:annotation>
              <xs:documentation>The possible title positions.</xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:string">
              <xs:enumeration value="Left">
                <xs:annotation>
                  <xs:documentation>Positions the title on the left side of the form header.</xs:documentation>
                </xs:annotation>
              </xs:enumeration>
              <xs:enumeration value="Right">
                <xs:annotation>
                  <xs:documentation>Positions the title on the right side of the form header.</xs:documentation>
                </xs:annotation>
              </xs:enumeration>
              <xs:enumeration value="RightOfImage">
                <xs:annotation>
                  <xs:documentation>Positions the title on the right side of the image in the form header.</xs:documentation>
                </xs:annotation>
              </xs:enumeration>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="colour" use="optional" default="000000" type="xs:hexBinary">
          <xs:annotation>
            <xs:documentation>The colour to use for the title.</xs:documentation>
          </xs:annotation>
        </xs:attribute>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="moduleConfiguration">
    <xs:annotation>
      <xs:documentation>Describes the configuration of a module.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="moduleName" type="moduleTitle">
        <xs:annotation>
          <xs:documentation>The name of the module.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="version" type="xs:string">
        <xs:annotation>
          <xs:documentation>mod's version name</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="author" type="xs:string">
        <xs:annotation>
          <xs:documentation>mod author</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="description" type="xs:string" minOccurs="0">
        <xs:annotation>
          <xs:documentation>Describes the configuration of a module.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="moduleImage" type="headerImage" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The module logo.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="moduleDependencies" type="compositeDependency" minOccurs="0">
        <xs:annotation>
          <xs:documentation>Items upon which the module depends.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="requiredInstallFiles" type="fileList" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The list of files and folders that must be installed for this module.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="installSteps" type="stepList" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The list of install steps that determine which files (or plugins) that may optionally be installed for this module.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="conditionalFileInstalls" type="conditionalFileInstallList" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The list of optional files that may optionally be installed for this module, base on condition flags.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="config" type="moduleConfiguration">
    <xs:annotation>
      <xs:documentation>The main element containing the module configuration info.</xs:documentation>
    </xs:annotation>
  </xs:element>
</xs:schema>