Imports System.IO
Imports System.Runtime.Serialization
Imports System.ServiceModel

Namespace Messages
    <Serializable>
    <DataContract>
    <KnownType(GetType(DBNull))>
    Public MustInherit Class BaseResponse
        <DataMember>
        Public Property OK As Boolean
        <DataMember>
        Public Property ErrorMessage As String

        Public Sub New()
            OK = True
        End Sub

        Public Sub New(ErrorMessage As String)
            OK = False
            Me.ErrorMessage = ErrorMessage
        End Sub
    End Class

    <MessageContract>
    Public Class DocumentStreamRequest
        <MessageBodyMember>
        Public ObjectId As Int64
    End Class

    <MessageContract>
    Public Class DocumentStreamResponse
        <MessageHeader(MustUnderstand:=True)>
        Public FileName As String

        <MessageBodyMember(Order:=1)>
        Public FileContents As Stream
    End Class

    Public Class DocumentListResponse
        Inherits BaseResponse

        Public Datatable As DataTable
    End Class

End Namespace



