<?xml version="1.0" encoding="utf-8"?>
<!--
Â© Copyright 2007 Infor Global Solutions Technology GmbH and/or its affiliates and subsidiaries. All rights reserved. The 
word and design marks set forth herein are trademarks and/or registered trademarks of Infor Global Solutions 
Technology GmbH and/or its affiliates and subsidiaries. All rights reserved. All other trademarks listed herein 
are the property of their respective owners.
 
-->

<!--    *****     Update Log     *****
 
Date          By      Note
3 Mar 2015    LA      New noun ContentDocument BOD-2889
21 Jul 2016   LA      New attribute value type elements added for integer etc. BOD-3221
 
        *****     Update End     *****
 
-->


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schema.infor.com/InforOAGIS/2"
    targetNamespace="http://schema.infor.com/InforOAGIS/2"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">
    
    <xsd:include schemaLocation="../Components/System/Components.xsd"/>
    
    <xsd:element name="ContentDocument" type="ContentDocumentType">
        <xsd:annotation>
            <xsd:documentation>
                To specify the details of documents that could get stored in a document management system
                like IDM .
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:complexType name="ContentDocumentType">
        <xsd:sequence>
            <xsd:element ref="DocumentID" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        This is the primary identifier of the document.
                        
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element ref="AlternateDocumentID" minOccurs="0" maxOccurs="unbounded">
                <xsd:annotation>
                    <xsd:documentation>
                        Any other alternate IDs for the document
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element ref="LastModificationDateTime" minOccurs="0"/>
            <xsd:element ref="LastModificationPerson" minOccurs="0"/>
            <xsd:element ref="DocumentDateTime" minOccurs="0"/>
            <xsd:element ref="Description" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="CreationDateTime" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Date time on which the document is created (in IDM)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element ref="CreationPerson" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Person who created the document
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element ref="Version" minOccurs="0"/>
            <xsd:element ref="Status" minOccurs="0"/>
            <xsd:element ref="DocumentMetaData" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Document meta data details, like attributes, resources etc that 
                        would depend on a document type.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element ref="DocumentResource" minOccurs="0" maxOccurs="unbounded">
                <xsd:annotation>
                    <xsd:documentation>
                        Contains the details about the binary meta data object. The main resource
                        would not have any 'type' associated; only other resources will have types. 
                        (example thumbnail preview etc)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            
            <xsd:element ref="AccessControlListID" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier for the set of authorizations for this document type (groups, users etc)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element ref="UserArea" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="DocumentMetaDataType">
        <xsd:sequence>
            <xsd:element ref="DocumentTypeID" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Indicates the document type identifier - this is a user-definable
                        identifier for the document
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            
            <xsd:element ref="Attribute" minOccurs="0" maxOccurs="unbounded">
                <xsd:annotation>
                    <xsd:documentation>
                        User-defined attributes that are defined for a 
                        specific document type; for example document's functional status could
                        be a user defined attribute; and then it would have name as "DocumentStatus" and 
                        Values as approved, pending, rejected.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
   
    <xsd:complexType name="AttributeType"> 
        <xsd:sequence>
            <xsd:element ref="RepresentativeIndicator" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                    Indicates whether the current attribute is used as a representative attribute
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element ref="Name" minOccurs="0"/>
            <xsd:element ref="AttributeType" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Data type for the attribute
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:choice>
                <xsd:element ref="AttributeValue" minOccurs="0">
                    <xsd:annotation>
                        <xsd:documentation>
                            Value of the attribute
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element ref="IntegerAttributeValue" minOccurs="0"/>
                <xsd:element ref="DecimalAttributeValue" minOccurs="0"/>
                <xsd:element ref="DateTimeAttributeValue" minOccurs="0"/>
                <xsd:element ref="BooleanAttributeValue" minOccurs="0"/>
                <xsd:element ref="TimeAttributeValue" minOccurs="0"/>
                <xsd:element ref="AttributeArrayValue" minOccurs="0" maxOccurs="unbounded">
                    <xsd:annotation>
                        <xsd:documentation>
                            Used when attribute type is an array type
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element ref="IntegerAttributeArrayValue" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="DecimalAttributeArrayValue" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="DateTimeAttributeArrayValue" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="BooleanAttributeArrayValue" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="TimeAttributeArrayValue" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="id" type="NormalizedStringType" use="optional">
            <xsd:annotation>
                <xsd:documentation>
                    To define the internal ID of the attribute within IDM
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>
    
    <xsd:complexType name="DocumentResourceType">
        <xsd:sequence>
            <xsd:element ref="FileSize" minOccurs="0"/>
            <xsd:element ref="MimeType" minOccurs="0"/>
            <xsd:element ref="FileName" minOccurs="0"/>
            <xsd:element ref="URL" minOccurs="0"/>
            <xsd:element ref="SHA256Hash" minOccurs="0"/>
            <xsd:element ref="Base64Binary" minOccurs="0"/>
        </xsd:sequence>
        <xsd:attribute name="type" type="NormalizedStringType" use="optional">
            <xsd:annotation>
                <xsd:documentation>
                    To define the type of resource - the main document resource will 
                    not have any type associated with it
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>
    
    <xsd:element name="AccessControlListID" type="IdentifierType"/>
    <xsd:element name="Attribute" type="AttributeType"/>
    <xsd:element name="AttributeType" type="CodeType"/>
   
    <xsd:element name="DocumentTypeID" type="IdentifierType"/>
    <xsd:element name="DocumentMetaData" type="DocumentMetaDataType"/>
    <xsd:element name="AttributeValue" type="NormalizedStringType"/>
    <xsd:element name="IntegerAttributeValue" type="IntegerNumericType"/>
    <xsd:element name="DecimalAttributeValue" type="NumericType"/>
    <xsd:element name="DateTimeAttributeValue" type="DateTimeType"/>
    <xsd:element name="BooleanAttributeValue" type="IndicatorType"/>
    <xsd:element name="TimeAttributeValue" type="TimeType"/>
    <xsd:element name="AttributeArrayValue" type="NormalizedStringType"/>
    <xsd:element name="IntegerAttributeArrayValue" type="IntegerNumericType"/>
    <xsd:element name="DecimalAttributeArrayValue" type="NumericType"/>
    <xsd:element name="DateTimeAttributeArrayValue" type="DateTimeType"/>
    <xsd:element name="BooleanAttributeArrayValue" type="IndicatorType"/>
    <xsd:element name="TimeAttributeArrayValue" type="TimeType"/>
    <xsd:element name="RepresentativeIndicator" type="IndicatorType"/>
    <xsd:element name="DocumentResource" type="DocumentResourceType"/>
    
    <xsd:element name="MimeType" type="NormalizedStringType"/>
    <xsd:element name="Base64Binary" type="BinaryObjectType"/>
    <xsd:element name="URL" type="URIType"/>
    <xsd:element name="SHA256Hash" type="NormalizedStringType"/>
</xsd:schema>