<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/data/graph"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:beans="http://www.springframework.org/schema/beans"
            xmlns:repository="http://www.springframework.org/schema/data/repository"
            xmlns:tool="http://www.springframework.org/schema/tool"

            targetNamespace="http://www.springframework.org/schema/data/graph"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified">

    <xsd:import namespace="http://www.springframework.org/schema/tool"/>
    <xsd:import namespace="http://www.springframework.org/schema/beans"/>
    <xsd:import namespace="http://www.springframework.org/schema/data/repository"
                schemaLocation="http://www.springframework.org/schema/data/repository/spring-repository.xsd"/>

   <xsd:element name="config">
      <xsd:complexType>
         <xsd:complexContent>
            <xsd:extension base="beans:identifiedType">
               <xsd:attribute name="storeDirectory" type="xsd:string" />
               <xsd:attribute name="graphDatabaseService" type="graphDatabaseServiceRef" />
               <xsd:attribute name="entityManagerFactory" type="xsd:string" />
            </xsd:extension>
         </xsd:complexContent>
      </xsd:complexType>
   </xsd:element>


   <xsd:complexType name="datagraph-repository">
    <xsd:complexContent>
      <xsd:extension base="repository:repository">
        <xsd:attribute name="graph-database-context-ref" type="graphDatabaseContextRef" default="graphDatabaseContext">
          <xsd:annotation>
            <xsd:documentation>
              The reference to a GraphDatabaseContext. Will default to 'graphDatabaseContext'.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attributeGroup ref="repository:repository-attributes"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="repositories">
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:extension base="repository:repositories">
          <xsd:sequence>
            <xsd:element name="repository" minOccurs="0" maxOccurs="unbounded" type="datagraph-repository"/>
          </xsd:sequence>
          <xsd:attribute name="graph-database-context-ref" type="graphDatabaseContextRef"/>
          <xsd:attributeGroup ref="repository:repository-attributes"/>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>

  <xsd:simpleType name="graphDatabaseContextRef">
    <xsd:annotation>
      <xsd:appinfo>
        <tool:annotation kind="ref">
          <tool:assignable-to type="org.springframework.data.graph.neo4j.support.GraphDatabaseContext"/>
        </tool:annotation>
      </xsd:appinfo>
    </xsd:annotation>
    <xsd:union memberTypes="xsd:string"/>
  </xsd:simpleType>

    <xsd:simpleType name="graphDatabaseServiceRef">
    <xsd:annotation>
      <xsd:appinfo>
        <tool:annotation kind="ref">
          <tool:assignable-to type="org.neo4j.graphdb.GraphDatabaseService"/>
        </tool:annotation>
      </xsd:appinfo>
    </xsd:annotation>
    <xsd:union memberTypes="xsd:string"/>
  </xsd:simpleType>

    <xsd:simpleType name="entityManagerFactoryRef">
    <xsd:annotation>
      <xsd:appinfo>
        <tool:annotation kind="ref">
          <tool:assignable-to type="org.springframework.orm.jpa.AbstractEntityManagerFactoryBean"/>
        </tool:annotation>
      </xsd:appinfo>
    </xsd:annotation>
    <xsd:union memberTypes="xsd:string"/>
  </xsd:simpleType>

</xsd:schema>