Imports System.IO
Imports System.ServiceModel
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Services.EDMIService.Exceptions
Imports DigitalData.Services.EDMIService.Messages
Imports DigitalData.Services.EDMIService.Methods
Imports DigitalData.Services.EDMIService.Methods.Database
Imports DigitalData.Services.EDMIService.Methods.IDB

<ServiceContract(Name:="IEDMIService", [Namespace]:="http://DigitalData.Services.EDMIService")>
Interface IEDMIService

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

    <OperationContract>
    Function GetClientConfig() As Base.GetClientConfig.GetClientConfigResponse
#End Region

#Region "Database"
    <OperationContract>
    Function GetCachedTables() As List(Of String)

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    <FaultContract(GetType(DataTableDoesNotExistFault))>
    Function ReturnDatatableFromCache(Name As String, FilterExpression As String, SortByColumn As String) As TableResult

    <OperationContract>
    Function ReturnDatatable(pData As GetDatatable.GetDatatableRequest) As GetDatatable.GetDatatableResponse

    <OperationContract>
    Function ReturnScalarValue(pData As GetScalarValue.GetScalarValueRequest) As GetScalarValue.GetScalarValueResponse

    <OperationContract>
    Function ExecuteNonQuery(pData As ExecuteNonQuery.ExecuteNonQueryRequest) As ExecuteNonQuery.ExecuteNonQueryResponse
#End Region

#Region "Database (Firebird)"
    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ReturnDatatable_Firebird(SQL As String) As TableResult

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ReturnScalar_Firebird(SQL As String) As ScalarResult

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ExecuteNonQuery_Firebird(SQL As String) As NonQueryResult
#End Region

#Region "Database (MSSQL IDB)"
    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ReturnDatatable_MSSQL_IDB(SQL As String) As TableResult

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ReturnScalar_MSSQL_IDB(SQL As String) As ScalarResult

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ExecuteNonQuery_MSSQL_IDB(SQL As String) As NonQueryResult
#End Region

#Region "Database (MSSQL ECM)"
    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ReturnDatatable_MSSQL_ECM(SQL As String) As TableResult

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ReturnScalar_MSSQL_ECM(SQL As String) As ScalarResult

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ExecuteNonQuery_MSSQL_ECM(SQL As String) As NonQueryResult
#End Region

#Region "Document (New)"
    <OperationContract>
    Function NewFile(Data As NewFile.NewFileRequest) As NewFile.NewFileResponse

    <OperationContract>
    Function UpdateFile(Data As UpdateFile.UpdateFileRequest) As UpdateFile.UpdateFileResponse

    <OperationContract>
    Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse

    <OperationContract>
    Function ImportFile(Data As GlobalIndexer.ImportFile.ImportFileRequest) As GlobalIndexer.ImportFile.ImportFileResponse

    <OperationContract>
    Function GetFileObject(Data As GetFileObject.GetFileObjectRequest) As GetFileObject.GetFileObjectResponse
#End Region

#Region "Document (Old)"

    <OperationContract>
    <FaultContract(GetType(ObjectDoesNotExistFault))>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function GetFileByObjectId(Data As DocumentStreamRequest) As DocumentStreamResponse

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function GetFileInfoByObjectId(Data As DocumentInfoRequest) As DocumentInfoResponse

    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function ListFilesForUser() As DocumentListResponse

#End Region

#Region "Helpers"
    <OperationContract>
    <FaultContract(GetType(UnexpectedErrorFault))>
    Function TestObjectIdExists(Data As TestObjectIdExistsRequest) As TestObjectIdExistsResponse
#End Region

End Interface