Imports System.IO
Imports System.ServiceModel
Imports DigitalData.Modules.Filesystem

<ServiceContract([Namespace]:="http://DigitalData.Services.IDBService")>
Interface IIDBService

#Region "Heartbeat"
    <OperationContract>
    Function Heartbeat() As Boolean
#End Region

#Region "Database"
    <OperationContract>
    Function CreateDatabaseRequest(Name As String, Optional Debug As Boolean = False) As String

    <OperationContract>
    Sub CloseDatabaseRequest()

    <OperationContract>
    Function ReturnDatatable(SQL As String) As TableResult

    <OperationContract>
    Function ReturnScalar(SQL As String) As ScalarResult

    <OperationContract>
    Function ExecuteNonQuery(SQL As String) As NonQueryResult
#End Region

#Region "Document (with FileContainer)"
    <OperationContract>
    Function NewFile(FileName As String, Contents As Byte()) As DocumentResult

    <OperationContract>
    Function UpdateFile(DocObject As DocumentObject, Contents As Byte()) As DocumentResult

    <OperationContract>
    Function GetFile(DocObject As DocumentObject) As DocumentResult

    <OperationContract>
    Function DeleteFile(DocObject As DocumentObject) As Boolean
#End Region

#Region "Document (New)"
    <OperationContract>
    Function ImportFile(FileInfo As FileInfo, Contents As Byte(), [ReadOnly] As Boolean, RetentionTime As Integer) As DocumentResult2
#End Region

#Region "Utils"
    <OperationContract>
    Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult

    <OperationContract>
    Function GetDocumentByContainerId(ContainerId As String) As DocumentResult
#End Region

#Region "Index"
    <OperationContract>
    Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult
#End Region

End Interface