<?xml version="1.0" encoding="$xmlEncoding"?>
<!-- 
    Attention: Generated code! Do not modify by hand!
    Generated by: XmlSchema.vsl in andromda-xmlschema-cartridge.
  -->
<xsd:schema 
    targetNamespace="http://fuge.org/core"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:fuge="http://fuge.org/core"
    elementFormDefault="qualified">
#foreach ($type in $types)
#set ($typeName = "${type.fullyQualifiedName}Type")
  <xsd:complexType name="$typeName" abstract = "${type.abstract}">
     <xsd:annotation>
          <xsd:documentation>${type.getDocumentation("")}</xsd:documentation>
		 </xsd:annotation>
#if ($type.generalization) 
    <xsd:complexContent>
     <xsd:extension base="fuge:${type.generalization.fullyQualifiedName}Type">
#end

#set( $doSeq = true)

#if ($type.associationEnds)
#foreach ($associationEnd in $type.associationEnds) 
#set ($otherEnd = $associationEnd.otherEnd)
#if ($otherEnd.navigable)
  #if ($doSeq) 
   <xsd:sequence>
    #set ($doSeq = false)
  #end
       #if($associationEnd.composition) 
       <xsd:element name="${otherEnd.name}" minOccurs="${otherEnd.minOccurs}" maxOccurs="1">
         <xsd:annotation>
          <xsd:documentation>${otherEnd.association.getDocumentation("")}
          </xsd:documentation>
		 </xsd:annotation>
         <xsd:complexType>
          <xsd:sequence> 
           <xsd:element ref="fuge:${otherEnd.type.name}" minOccurs="1" maxOccurs="${otherEnd.maxOccurs}"/>
          </xsd:sequence>
         </xsd:complexType>
        </xsd:element>      
       #else
       <xsd:element name="${otherEnd.name}" minOccurs="${otherEnd.minOccurs}" maxOccurs="1">
         <xsd:annotation>
          <xsd:documentation>This is a reference to an object (or its subclasses) of type: ${otherEnd.association.getDocumentation("")}</xsd:documentation>
		 </xsd:annotation>
         <xsd:complexType>
          <xsd:sequence> 
           <xsd:element name="${otherEnd.type.name}_ref"  minOccurs="1" maxOccurs="${otherEnd.maxOccurs}">
          		  <xsd:complexType>
        			   <xsd:attribute name="identifier_ref" use="required" type="xsd:string"/>
        		</xsd:complexType>
         	</xsd:element>	
           </xsd:sequence>
         </xsd:complexType>
        </xsd:element>
       #end        
#end
#end


#if (!$doSeq) 
    </xsd:sequence> 
#set ($doSeq = true)
#end

#end



#foreach  ($attribute in $type.attributes)
#if($attribute.name == "action" && $typeName == "FuGE.Common.Audit.AuditType")
 	<xsd:attribute name="action" use="required">
 	  <xsd:annotation>
      <xsd:documentation>${attribute.getDocumentation("")}</xsd:documentation>
	 </xsd:annotation>
   	 <xsd:simpleType>
	  <xsd:restriction base="xsd:string">
	   <xsd:enumeration value="creation"/>
	   <xsd:enumeration value="modification"/>
	   <xsd:enumeration value="deletion"/>
	  </xsd:restriction>
	 </xsd:simpleType>
	</xsd:attribute>
#elseif($attribute.type.fullyQualifiedName  == "anyType[]")
	  <xsd:sequence>
       <xsd:element  name="${attribute.name}" type="xsd:anyType">	
 	    <xsd:annotation>
         <xsd:documentation>${attribute.getDocumentation("")}</xsd:documentation>
	    </xsd:annotation>
       </xsd:element>	
      </xsd:sequence>
#else
#if($attribute.required) 
    <xsd:attribute name="${attribute.name}" use="required" type="xsd:${attribute.type.fullyQualifiedName}">
#else
    <xsd:attribute name="${attribute.name}" type="xsd:${attribute.type.fullyQualifiedName}">
#end
     <xsd:annotation>
      <xsd:documentation>${attribute.getDocumentation("")}</xsd:documentation>
	 </xsd:annotation>
    </xsd:attribute>	 
#end
#end

#if ($type.generalization) 
    </xsd:extension>
    </xsd:complexContent>
#end

  </xsd:complexType>

  
#end

#foreach ($element in $types)
#set ($typeName = "${element.fullyQualifiedName}Type")
#if ($element.generalization) 
 <xsd:element name="$element.name" type="fuge:$typeName" abstract="$element.abstract" substitutionGroup="fuge:${element.generalization.name}" />
#else
 <xsd:element name="$element.name" type="fuge:$typeName" abstract="$element.abstract" />
#end
#end

</xsd:schema>     
