´╗┐Option Explicit On
Option Strict On

Imports System
Imports System.Xml

'**********************************************************************************************
'* Copyright (c) 2001-2017 Liquid Technologies Limited. All rights reserved.
'* See www.liquid-technologies.com for product details.
'*
'* Please see products End User License Agreement for distribution permissions.
'*
'* WARNING: THIS FILE IS GENERATED
'* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten
'*
'* Generation  :  by Liquid XML Data Binder 15.0.1.7161
'* Using Schema: D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\SimpleHierarchy\Schema\SimpleHierarchy.xsd
'**********************************************************************************************

Namespace SimpleHierarchyLib

    ''' <summary>
    ''' This class represents the Element Invoice
    ''' </summary>
    <LiquidTechnologies.Runtime.Net45.XmlObjectInfo(LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementGroupType.Sequence, _
                                                    LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element, _
                                                    "Invoice", "", true, false, _
                                                    LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_none, Nothing, false)> _
    Public Partial Class Invoice
        Inherits SimpleHierarchyLib.XmlCommonBase

        #Region "Constructors"
        ''' <summary>
        '''    Constructor for Invoice
        ''' </summary>
        ''' <remarks>
        '''    The class is created with all the mandatory fields populated with the
        '''    default data. 
        '''    All Collection object are created.
        '''    However any 1-n relationships (these are represented as collections) are
        '''    empty. To comply with the schema these must be populated before the xml
        '''    obtained from ToXml is valid against the schema D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\SimpleHierarchy\Schema\SimpleHierarchy.xsd
        ''' </remarks>
        Public Sub New()
            _elementName = "Invoice"
            Init()
        End Sub
        
        Public Sub New(ByVal elementName as String)
            _elementName = elementName
            Init()
        End Sub
        #End Region

        #Region "Initialization methods for the class"
        ''' <summary>
        '''    Initializes the class
        ''' </summary>
        ''' <remarks>
        '''    The Creates all the mandatory fields (populated with the default data) 
        '''    All Collection object are created.
        '''    However any 1-n relationships (these are represented as collections) are
        '''    empty. To comply with the schema these must be populated before the xml
        '''    obtained from ToXml is valid against the schema D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\SimpleHierarchy\Schema\SimpleHierarchy.xsd.
        ''' </remarks>
        Protected Overrides Sub Init()
            SimpleHierarchyLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place
            _InvoiceNo = Convert.ToUInt32(0)
            _DeliveryAddress = new SimpleHierarchyLib.AddressType("DeliveryAddress")
            _BillingAddress = Nothing
            _Item = new SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.ItemType)("Item", "", 1, -1, false)
            _Payment = new SimpleHierarchyLib.Payment("Payment")



' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional initialization code here...

' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
        End Sub

        #End Region

        #Region "ICloneable Interface"
        ''' <summary>
        '''    Allows the class to be copied
        ''' </summary>
        ''' <remarks>
        '''    Performs a 'deep copy' of all the data in the class (and its children)
        ''' </remarks>
        Public Overrides Function Clone() As Object
            Dim newObject As New SimpleHierarchyLib.Invoice(_elementName)
            Dim o As Object
            newObject._InvoiceNo = _InvoiceNo
            newObject._DeliveryAddress = Nothing
            if (Not _DeliveryAddress Is Nothing) Then
                newObject._DeliveryAddress = CType(_DeliveryAddress.Clone(), SimpleHierarchyLib.AddressType)
            End If
            newObject._BillingAddress = Nothing
            if (Not _BillingAddress Is Nothing) then
                newObject._BillingAddress = CType(_BillingAddress.Clone(), SimpleHierarchyLib.AddressType)
            End If
            For Each o in _Item
                newObject._Item.Add(CType(CType(o, SimpleHierarchyLib.ItemType).Clone(), SimpleHierarchyLib.ItemType))
            Next o
            newObject._Payment = Nothing
            if (Not _Payment Is Nothing) Then
                newObject._Payment = CType(_Payment.Clone(), SimpleHierarchyLib.Payment)
            End If

            o = Nothing


' ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional clone code here...

' ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

            Return newObject
        End Function
        #End Region

        #Region "Member variables"

        Protected Overrides Readonly Property TargetNamespace() as String
            Get 
                Return ""
            End Get
        End Property

        #Region "Attribute - InvoiceNo"
        ''' <summary>
        ''' Represents a mandatory Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is mandatory and therefore must be populated within the XML.
        ''' It is defaulted to Convert.ToUInt32(0).
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqPrimMnd("InvoiceNo", "", Nothing, LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_ui4, Nothing, LiquidTechnologies.Runtime.Net45.WhitespaceUtils.WhitespaceRule.Collapse, "", "-1", "-1", "", "", "", "", "-1", "-1", "-1")> _
        Public Property InvoiceNo() as UInteger
            Get 
                Return _InvoiceNo  
            End Get
            Set(ByVal value As UInteger) 
                CheckElementRestriction(0, value)
                _InvoiceNo = value 
            End Set
        End Property
        Protected _InvoiceNo As UInteger

        #End Region
    
        #Region "Attribute - DeliveryAddress"
        ''' <summary>
        ''' Represents a mandatory Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is mandatory and therefore must be populated within the XML.
        ''' If this property is set, then the object will be COPIED. If the property is set to null an exception is raised.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqClsMnd("DeliveryAddress", "", LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element, GetType(SimpleHierarchyLib.AddressType), true)> _
        Public Property DeliveryAddress() As SimpleHierarchyLib.AddressType
            Get 
                Return _DeliveryAddress  
            End Get
            Set(ByVal value As SimpleHierarchyLib.AddressType)  
                Throw_IfPropertyIsNull(value, "DeliveryAddress")
                if (Not value Is Nothing) Then
                    SetElementName(value, "DeliveryAddress")
                End If
                _DeliveryAddress = value 
            End Set
        End Property
        Protected _DeliveryAddress As SimpleHierarchyLib.AddressType
        
        #End Region
    
        #Region "Attribute - BillingAddress"
        ''' <summary>
        ''' Represents an optional Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is optional, initially it is null.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqClsOpt("BillingAddress", "", LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element, GetType(SimpleHierarchyLib.AddressType))> _
        Public Property BillingAddress() As SimpleHierarchyLib.AddressType
            Get 
                Return _BillingAddress  
            End Get
            Set(ByVal value As SimpleHierarchyLib.AddressType) 
                if (value Is Nothing) Then
                    _BillingAddress = Nothing
                else
                    SetElementName(value, "BillingAddress")
                    _BillingAddress = value 
                End If
            End Set
        End Property
        Protected _BillingAddress As SimpleHierarchyLib.AddressType
        
        #End Region
    
        #Region "Attribute - Item"
        ''' <summary>
        ''' A collection of Items
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' This collection may contain 1 to Many objects.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqClsCol("Item", "", LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element)> _
        Public Readonly Property Item() As SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.ItemType)
            Get 
                Return _Item 
            End Get
        End Property
        Protected _Item As SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.ItemType)
        
        #End Region
    
        #Region "Attribute - Payment"
        ''' <summary>
        ''' Represents a mandatory Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is mandatory and therefore must be populated within the XML.
        ''' If this property is set, then the object will be COPIED. If the property is set to null an exception is raised.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqClsMnd("Payment", "", LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element, GetType(SimpleHierarchyLib.Payment), true)> _
        Public Property Payment() As SimpleHierarchyLib.Payment
            Get 
                Return _Payment  
            End Get
            Set(ByVal value As SimpleHierarchyLib.Payment)  
                Throw_IfPropertyIsNull(value, "Payment")
                if (Not value Is Nothing) Then
                    SetElementName(value, "Payment")
                End If
                _Payment = value 
            End Set
        End Property
        Protected _Payment As SimpleHierarchyLib.Payment
        
        #End Region
    
        #Region "Attribute - Namespace"
        Public Overrides Readonly Property [Namespace]() As String
            Get 
                Return ""  
            End Get
        End Property
        #End Region

        #Region "Attribute - GetBase"
        Public Overrides Function GetBase() As LiquidTechnologies.Runtime.Net45.XmlObjectBase
            Return Me
        End Function
        #End Region
        #End Region


' ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional Methods and members here...

' ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    End Class
End Namespace