<?xml version="1.0" encoding="UTF-8"?>
<!-- =====================================================================================
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the repository root for full copyright notice.
========================================================================================== -->
<ECSchema schemaName="ECDbFileInfo" alias="ecdbf" version="02.00.01" description="ECDb FileInfo" displayLabel="ECDb FileInfo" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
    <ECSchemaReference name="ECDbMap" version="02.00.00" alias="ecdbmap"/>
    <ECSchemaReference name="CoreCustomAttributes" version="01.00.00" alias="CoreCA"/>

    <ECEntityClass typeName="FileInfo" description="Abstract base class for holding attributes of a file" modifier="Abstract">
        <ECProperty propertyName="Name" typeName="string" description="File name"/>
        <ECProperty propertyName="Size" typeName="long" description="File size"/>
        <ECProperty propertyName="Description" typeName="string" description="File description"/>
        <ECProperty propertyName="LastModified" typeName="dateTime" description="Time the file was last modified.">
            <ECCustomAttributes>
                <DateTimeInfo xmlns="CoreCustomAttributes.01.00.00">
                    <DateTimeKind>Utc</DateTimeKind>
                </DateTimeInfo>
            </ECCustomAttributes>
        </ECProperty>
    </ECEntityClass>
    <ECEntityClass typeName="EmbeddedFileInfo" modifier="Sealed" description="Attributes of a file stored in the ECDb file." displayLabel="Embedded File Info">
        <ECCustomAttributes>
            <ClassMap xmlns="ECDbMap.02.00.00">
                <MapStrategy>ExistingTable</MapStrategy>
                <TableName>be_EmbedFile</TableName>
            </ClassMap>
        </ECCustomAttributes>
        <BaseClass>FileInfo</BaseClass>
        <ECProperty propertyName="Name" typeName="string" description="File name">
            <ECCustomAttributes>
                <PropertyMap xmlns="ECDbMap.02.00.00">
                    <IsNullable>False</IsNullable>
                    <IsUnique>True</IsUnique>
                    <Collation>NoCase</Collation>
                </PropertyMap>
            </ECCustomAttributes>
        </ECProperty>
        <ECProperty propertyName="Description" typeName="string" description="File description">
            <ECCustomAttributes>
                <PropertyMap xmlns="ECDbMap.02.00.00">
                    <ColumnName>Descr</ColumnName>
                </PropertyMap>
            </ECCustomAttributes>
        </ECProperty>
        <ECProperty propertyName="Type" typeName="string" description="File type"/>
    </ECEntityClass>
    
    <ECEnumeration typeName="StandardRootFolderType" backingTypeName="int" isStrict="False" description="Discrete set of root folders defined by the application. The DgnClientFx's standard root folders are reserved folders. Custom root folders must use ids other than the ones used for the standard root folders." displayLabel="Root Folder Type">
        <ECEnumerator name="DocumentsFolder" value="0" displayLabel="DocumentsFolder" />
        <ECEnumerator name="TemporaryFolder" value="1"  displayLabel="TemporaryFolder"/>
        <ECEnumerator name="CachesFolder" value="2" displayLabel="CachesFolder" />
        <ECEnumerator name="LocalStateFolder" value="3" displayLabel="LocalStateFolder" />
    </ECEnumeration>
    
    <ECEntityClass typeName="ExternalFileInfo" description="Attributes of a file stored external to the repository." displayLabel="External File Info">
        <ECCustomAttributes>
            <ClassMap xmlns="ECDbMap.02.00.00">
                <MapStrategy>TablePerHierarchy</MapStrategy>
            </ClassMap>
            <ShareColumns xmlns="ECDbMap.02.00.00">
                <ApplyToSubclassesOnly>True</ApplyToSubclassesOnly>
            </ShareColumns>
        </ECCustomAttributes>
        <BaseClass>FileInfo</BaseClass>
        <ECProperty propertyName="RootFolder" typeName="StandardRootFolderType" description="Discrete set of root folders defined by the application. The DgnClientFx's standard root folders are reserved folders. Custom root folders must use ids other than the ones used for the standard root folders." />
        <ECProperty propertyName="RelativePath" typeName="string" description="File path relative to root folder"/>
    </ECEntityClass>
    
    <ECEntityClass typeName="FileInfoOwnership" modifier="Sealed">
        <ECCustomAttributes>
            <DbIndexList xmlns="ECDbMap.02.00.00">
                  <Indexes>
                    <DbIndex>
                        <Name>uix_ecdbf_fileinfoownership_fileinfoid_fileinfoecclassid</Name>
                        <IsUnique>True</IsUnique>
                        <Properties>
                            <string>FileInfoId</string>
                            <string>FileInfoECClassId</string>
                        </Properties>
                    </DbIndex>
                    <DbIndex>
                        <Name>uix_ecdbf_fileinfoownership_ownerid_ownerecclassid</Name>
                        <IsUnique>True</IsUnique>
                        <Properties>
                            <string>OwnerId</string>
                            <string>OwnerECClassId</string>
                        </Properties>
                    </DbIndex>
                    <DbIndex>
                        <Name>ix_ecdbf_fileinfoownership_ownerecclassid</Name>
                        <Properties>
                            <string>OwnerECClassId</string>
                        </Properties>
                    </DbIndex>
                </Indexes>
            </DbIndexList>
        </ECCustomAttributes>
        <ECProperty propertyName="OwnerId" typeName="long" extendedTypeName="Id">
            <ECCustomAttributes>
                <PropertyMap xmlns="ECDbMap.02.00.00">
                    <IsNullable>False</IsNullable>
                </PropertyMap>
            </ECCustomAttributes>
        </ECProperty>
        <ECProperty propertyName="OwnerECClassId" typeName="long" extendedTypeName="Id">
            <ECCustomAttributes>
                <PropertyMap xmlns="ECDbMap.02.00.00">
                    <IsNullable>False</IsNullable>
                </PropertyMap>
            </ECCustomAttributes>
        </ECProperty>
        <ECProperty propertyName="FileInfoId" typeName="long" extendedTypeName="Id">
            <ECCustomAttributes>
                <PropertyMap xmlns="ECDbMap.02.00.00">
                    <IsNullable>False</IsNullable>
                </PropertyMap>
            </ECCustomAttributes>
        </ECProperty>
        <ECProperty propertyName="FileInfoECClassId" typeName="long" extendedTypeName="Id">
            <ECCustomAttributes>
                <PropertyMap xmlns="ECDbMap.02.00.00">
                    <IsNullable>False</IsNullable>
                </PropertyMap>
            </ECCustomAttributes>
        </ECProperty>
    </ECEntityClass>
</ECSchema>
