// As found in WINDREAMLib
export const enum WMObjectStatus
{
    WMObjectStatusCreated = 0,
    WMObjectStatusLocked = 1,
    WMObjectStatusDeleted = 2,
    WMObjectStatusNew = 4,
    WMObjectStatusIndexEdit = 4,
    WMObjectStatusSaved = 8,
    WMObjectStatusSystemEdit = 8,
    WMObjectStatusReadOnly = 16,
    WMObjectStatusDirty = 32,
    WMObjectStatusVirtual = 64,
    WMObjectStatusNoContentRead = 64,
    WMObjectStatusAdminEdit = 128,
    WMObjectStatusTTSUserDeleted = 128,
    WMObjectStatusEdit = 256,
    WMObjectStatusNoIndex = 512,
    WMObjectStatusHasExtension = 1024,
    WMObjectStatusLoggedIn = 1024,
    WMObjectStatusAttrDBIndex = 1024,
    WMObjectStatusPreVersion = 2048,
    WMObjectStatusFulltextNeed = 4096,
    WMObjectStatusMainUser = 4096,
    WMObjectStatusArchived = 8192,
    WMObjectStatusDelegateUser = 8192,
    WMObjectStatusRefresh = 16384,
    WMObjectStatusWorkLockEditOnly = 16384,
    WMObjectStatusNoRights = 32768,
    WMObjectStatusTemporary = 65536,
    WMObjectStatusFulltextError = 131072,
    WMObjectStatusPermanentLock = 262144,
    WMObjectStatusRelationLock = 524288,
    WMObjectStatusOTArchivedEditable = 524288,
    WMObjectStatusMarkedForArchive = 1048576,
    WMObjectStatusManualArchived = 2097152,
    WMObjectStatusObjectDefault = 2097152,
    WMObjectStatusSBX = 4194304,
    WMObjectStatusTypeAssigned = 4194304,
    WMObjectStatusCheckOutEditOnly = 8388608,
    WMObjectStatusOwnerRights = 8388608,
    WMObjectStatusVersionable = 16777216,
    WMObjectStatusInUse = 16777216,
    WMObjectStatusInactive = 33554432,
    WMObjectStatusManualFulltext = 33554432,
    WMObjectStatusAsyncProxyBinary = 33554432,
    WMObjectStatusBinaryReadOnly = 67108864,
    WMObjectStatusArchiveCertified = 67108864,
    WMObjectStatusParentOwnerRights = 67108864,
    WMObjectStatusUserWorkLock = 134217728,
    WMObjectStatusExternalHistory = 268435456,
    WMObjectStatusSubscribe = 268435456,
    WMObjectStatusLifeCycleEditDenied = 536870912,
    WMObjectStatusHSMBinary = 1073741824
}

export const enum WSAttributeFlags
{
    Default = 0,
    Objecttype = 2,
    Parent = 4,
    ValuesOnly = 8,
    Values = 16,
    System = 32,
    IndexmaskData = 64,
    OnlySearchable = 128,
    NonSortable = 256,
    Virtual = 512,
    Global = 1024
}

export const enum WSValueType
{
    Undefined = 0,
    Int = 1,
    Int64 = 2,
    String = 3,
    Double = 4,
    Vector = 5,
    Boolean = 6,
    Float = 7,
    DateTime = 8,
    Date = 9,
    Decimal = 10
}

export const enum BaseEntityDTO
{
    DocumentAndMap = 0,
    Document = 1,
    Folder = 2
}

export const enum ItemEntityDTO
{
    DocumentAndMap = 0,
    Document = 1,
    Folder = 2
}

export interface ExistingItemIdentityDTO extends IdLocationNameIdentityDTO
{
}

export interface IdLocationNameEntityIdentityDTO extends IdLocationNameIdentityDTO
{
    Entity: BaseEntityDTO;
}

export interface IdLocationNameEntityIdentityResponseDTO extends IdLocationNameIdentityResponseDTO
{
    Entity: BaseEntityDTO;
}

export interface IdLocationNameIdentityDTO extends LocationNameIdentityDTO
{
    Id: number;
}

export interface IdLocationNameIdentityResponseDTO extends IdLocationNameIdentityDTO
{
    LocationComplete: string;
}

export interface IdNameIdentityDTO extends NameIdentityDTO
{
    Id: number;
}

export interface ItemContainerDTO
{
    Item: IdLocationNameIdentityDTO;
}

export interface ItemResponseDTO extends IdLocationNameEntityIdentityResponseDTO
{
    Attributes: AttributeResponseDTO[];
    ObjectType: ObjectTypeIdentityDTO;
    ParentWindreamObject: IdLocationNameEntityIdentityResponseDTO;
}

export interface LocationNameIdentityDTO extends NameIdentityDTO
{
    Location: string;
}

export interface NameIdentityDTO
{
    Name: string;
}

export interface NameValuePairDTO extends NameIdentityDTO
{
    Value: any;
}

export interface NewItemIdentityDTO extends LocationNameIdentityDTO
{
}

export interface VectorDetailsDTO
{
    EntriesLimit?: number;
}

export interface AttributeResponseDTO
{
    DisplayName: string;
    IsSortable: boolean;
    IsSystem: boolean;
    Name: string;
    Type: WSValueType;
    UnderlyingType?: WSValueType;
    Value: any;
    VectorDetails?: VectorDetailsDTO;
}

export interface AttributeDTO extends NameValuePairDTO
{
}

export interface ErrorResponseDTO
{
    ErrorCode: number;
    Message: string;
}

export const enum ObjectTypeEntityDTO
{
    DocumentAndMap = 0,
    Document = 1,
    Folder = 2,
    ObjectType = 10
}

export interface GetObjectTypeDTO
{
    AttributeFlags: WSAttributeFlags;
    Item: ObjectTypeIdentityDTO;
    Values: string[];
}

export interface ObjectTypeFullIdentityDTO extends IdNameIdentityDTO
{
    Entity: ObjectTypeEntityDTO;
}

export interface ObjectTypeIdentityDTO extends IdNameIdentityDTO
{
}

export interface ObjectTypeResponseContainerDTO extends ResponseContainerDTO
{
    Item: ObjectTypeResponseDTO;
}

export interface ObjectTypeResponseDTO extends ObjectTypeFullIdentityDTO
{
    Attributes: AttributeResponseDTO[];
    ObjectType: ObjectTypeFullIdentityDTO;
}

export const enum ResponseDetailsType
{
    Always = 0,
    Failed = 1,
    Succeeded = 2,
    None = 3
}

export interface ItemResponseContainerDTO extends ResponseContainerDTO
{
    Item: IdLocationNameEntityIdentityResponseDTO;
}

export interface ResponseContainerDTO
{
    Error?: ErrorResponseDTO;
    HasErrors: boolean;
}

export const enum SortDirection
{
    Ascending = 0,
    Descending = 1
}

export interface SortConditionDTO
{
    AttributeName: string;
    Direction: SortDirection;
}