<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ekmTypes="http://www.ansys.com/ekm/types"
    targetNamespace="http://www.ansys.com/ekm/types"
    xmlns:ekmScript="http://www.ansys.com/ekm/script">

    <xsd:import namespace="http://www.ansys.com/ekm/script" schemaLocation="script.xsd"/>

    <xsd:simpleType name="Version">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[0-9]+(\.[0-9]+)*"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="Constraint">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="value" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="Property">
        <xsd:sequence>
            <xsd:element name="defaultValue" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="enumeration" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="constraint" type="ekmTypes:Constraint" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="type" use="required">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="Boolean"/>
                    <xsd:enumeration value="Date"/>
                    <xsd:enumeration value="Double"/>
                    <xsd:enumeration value="Long"/>
                    <xsd:enumeration value="String"/>
                    <xsd:enumeration value="Reference"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="specifiedBy" use="optional">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="extractor"/>
                    <xsd:enumeration value="system"/>
                    <xsd:enumeration value="user"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="label" type="xsd:string" use="optional"/>
        <xsd:attribute name="multivalued" type="xsd:boolean" use="optional"/>
        <xsd:attribute name="required" type="xsd:boolean" use="optional"/>
        <xsd:attribute name="category" type="xsd:string" use="optional"/>
        <xsd:attribute name="displayOrder" type="xsd:int" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="Properties">
        <xsd:sequence>
            <xsd:element name="property" type="ekmTypes:Property" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="Action">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="macro" type="xsd:string" use="required"/>
        <xsd:attribute name="permissions" type="xsd:string" use="required"/>
        <xsd:attribute name="icon" type="xsd:string" use="optional"/>
		<xsd:attribute name="multiSelectEnabled" type="xsd:boolean" use="optional"/>
    </xsd:complexType>
    
    <xsd:complexType name="View">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="initMacro" type="xsd:string" use="required"/>
    </xsd:complexType>
    
    <xsd:complexType name="Views">
        <xsd:sequence>
            <xsd:element name="view" type="ekmTypes:View" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="defaultView" type="xsd:string" minOccurs="0" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="Actions">
        <xsd:sequence>
            <xsd:element name="script" type="ekmScript:Script" minOccurs="0"/>
            <xsd:element name="action" type="ekmTypes:Action" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="removedAction" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="Extension">
        <xsd:sequence>
            <xsd:element name="mixins" type="ekmTypes:Mixins" minOccurs="0"/>
            <xsd:element name="actions" type="ekmTypes:Actions" minOccurs="0"/>
            <xsd:element name="views" type="ekmTypes:Views" minOccurs="0"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string" use="optional"/>
        <xsd:attribute name="extends" type="xsd:string" use="required"/> 
    </xsd:complexType>

    <xsd:complexType name="Mixin">
        <xsd:sequence>
            <xsd:element name="properties" type="ekmTypes:Properties" minOccurs="0"/>
            <xsd:element name="children" type="ekmTypes:Children" minOccurs="0"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="version" type="ekmTypes:Version" use="required"/> 
    </xsd:complexType>

    <xsd:complexType name="Mixins">
        <xsd:sequence>
            <xsd:element name="mixin" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="Child">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="type" type="xsd:string" use="required"/>
        <xsd:attribute name="occurs" use="required">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="list"/>
                    <xsd:enumeration value="optional"/>
                    <xsd:enumeration value="required"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:complexType name="Children">
        <xsd:sequence>
            <xsd:element name="child" type="ekmTypes:Child" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="TypeAttribute">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="value" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="TypeAttributes">
        <xsd:sequence>
            <xsd:element name="typeAttribute" type="ekmTypes:TypeAttribute" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="Type">
        <xsd:all>
            <xsd:element name="properties" type="ekmTypes:Properties" minOccurs="0"/>
            <xsd:element name="children" type="ekmTypes:Children" minOccurs="0"/>
            <xsd:element name="mixins" type="ekmTypes:Mixins" minOccurs="0"/>
            <xsd:element name="typeAttributes" type="ekmTypes:TypeAttributes" minOccurs="0"/>
            <xsd:element name="actions" type="ekmTypes:Actions" minOccurs="0"/>
            <xsd:element name="views" type="ekmTypes:Views" minOccurs="0"/>
        </xsd:all>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="extends" type="xsd:string" use="optional"/>
        <xsd:attribute name="label" type="xsd:string" use="optional"/>
        <xsd:attribute name="version" type="ekmTypes:Version" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="Types">
        <xsd:choice minOccurs="1" maxOccurs="1">
            <xsd:element name="type" type="ekmTypes:Type"/>
            <xsd:element name="mixin" type="ekmTypes:Mixin"/>
            <xsd:element name="extension" type="ekmTypes:Extension"/>
        </xsd:choice>
    </xsd:complexType>

    <xsd:element name="types" type="ekmTypes:Types"/>

</xsd:schema>