Imports DigitalData.Modules.Interfaces.ZUGFeRDInterface

Public Class Exceptions
    Public Class ZUGFeRDExecption
        Inherits ApplicationException

        Public ReadOnly Property ErrorCode() As ErrorCodes

        Public ReadOnly Property Param1 As String = String.Empty

        Public ReadOnly Property Param2 As String = String.Empty

        ''' <summary>
        ''' Contains the name of the extracted xml file if already extracted.
        ''' </summary>
        ''' <returns>A filename like zugferd-invoice.xml</returns>
        Public ReadOnly Property XmlFile As String = String.Empty

        Public Sub New(pErrorCode As ErrorCodes, Message As String)
            MyBase.New(Message)

            _ErrorCode = pErrorCode
        End Sub

        Public Sub New(pErrorCode As ErrorCodes, Message As String, pXmlFileName As String)
            MyBase.New(Message)

            _ErrorCode = pErrorCode
            _XmlFile = pXmlFileName
        End Sub

        Public Sub New(pErrorCode As ErrorCodes, Param1 As String, Param2 As String, Message As String)
            MyBase.New(Message)

            _ErrorCode = pErrorCode
            _Param1 = Param1
            _Param2 = Param2

        End Sub

        Public Sub New(pErrorCode As ErrorCodes, Param1 As String, Param2 As String, Message As String, pXmlFileName As String)
            MyBase.New(Message)

            _ErrorCode = pErrorCode
            _Param1 = Param1
            _Param2 = Param2
            _XmlFile = pXmlFileName

        End Sub
    End Class

    Public Class ValidationException
        Inherits ApplicationException

        Public ValidationErrors As List(Of ZugferdValidationError)

        Public ReadOnly Property ErrorCode() As ErrorCodes

        Public Sub New()
            MyBase.New("ZUGFeRD document found but validation failed!")

            _ErrorCode = ErrorCodes.ValidationException
        End Sub

    End Class
End Class
