Imports System.Collections.Generic
Imports CharterDotCom.CommonEntities.Library.Common
Imports CharterDotCom.CommonEntities.Library.Enumerations



<Serializable()> _
Public Class BLFeature
    Implements ISubCartItem

    Public m_gwyFeature As Feature
    Private m_serviceType As ServiceType
    Private m_selected As Boolean = False
    Private m_available As Boolean = True
    Private m_removable As Boolean = True
    Private m_selectionQuantity As Integer
    Private m_children As Dictionary(Of String, ISubCartItem)
    Private m_choiceSelection As List(Of String)
    Private m_visible As Boolean = True
    'Private m_installDescription As String
    Private m_selectedChoices As List(Of String)
    'Private m_text As String
    'Private m_maxLength As Integer

    Public Sub New(ByVal f As Feature)
        m_gwyFeature = f
        m_selectedChoices = New List(Of String)
    End Sub

    Public ReadOnly Property ID() As String Implements ISubCartItem.ID
        Get
            Return ItemType.Feature & m_gwyFeature.ID
        End Get
    End Property

    Public ReadOnly Property Name() As String Implements ISubCartItem.Name
        Get
            Return m_gwyFeature.Name
        End Get
    End Property

    Public ReadOnly Property Description() As String Implements ISubCartItem.Description
        Get
            Return m_gwyFeature.Description
        End Get
    End Property

    Private ReadOnly Property InstallPrice() As Decimal Implements ISubCartItem.InstallPrice
        Get
            Return 0
        End Get
    End Property

    Private ReadOnly Property InstallDescription() As String Implements ISubCartItem.InstallDescription
        Get
            Return String.Empty
        End Get
    End Property

    Public ReadOnly Property Type() As ItemType Implements ISubCartItem.Type
        Get
            Return ItemType.Feature
        End Get
    End Property

    Public ReadOnly Property Category() As Category Implements ISubCartItem.Category
        Get
            Return Common.ConvertToUICategory(m_gwyFeature.Category)
        End Get
    End Property

    Public ReadOnly Property ServiceType() As ServiceType
        Get
            Return m_serviceType
        End Get
    End Property

    Public ReadOnly Property FeatureCategory() As FeatureCategory
        Get
            Return m_gwyFeature.FeatureCategory
        End Get
    End Property

    Private ReadOnly Property FType() As FeatureType Implements ISubCartItem.FeatureType
        Get
            Return Common.ConvertTOUIFeatureType(m_gwyFeature.FeatureType)
        End Get
    End Property

    Public Property FeatureType() As FeatureType
        Get
            Return FType
        End Get
        Set(ByVal value As FeatureType)
            m_gwyFeature.FeatureType = Common.ConvertTOGWYFeatureType(value)
        End Set
    End Property

    Public ReadOnly Property InputType() As InputType Implements ISubCartItem.InputType
        Get
            Return ConvertToUIInPutType(m_gwyFeature.InputType)
        End Get
    End Property

    Private Property SPPrice() As Decimal Implements ISubCartItem.Price
        Get
            Return m_gwyFeature.Price
        End Get
        Set(ByVal value As Decimal)
            m_gwyFeature.Price = value
        End Set
    End Property

    Public Property Price() As Decimal
        Get
            Return m_gwyFeature.Price
        End Get
        Set(ByVal value As Decimal)
            m_gwyFeature.Price = value
        End Set
    End Property

    Public Property ListPrice() As Decimal Implements ISubCartItem.ListPrice
        Get
            Return m_gwyFeature.ListPrice
        End Get
        Set(ByVal value As Decimal)
            m_gwyFeature.ListPrice = value
        End Set
    End Property

    Public ReadOnly Property PriceDisplay() As Boolean Implements ISubCartItem.IsPriceDisplayed
        Get
            Return m_gwyFeature.PriceDisplay
        End Get
    End Property

    Public ReadOnly Property PriceFrequency() As BLPriceFrequency Implements ISubCartItem.PriceFrequency
        Get
            Return ConvertToUIPriceFrequency(m_gwyFeature.PriceFrequency)
        End Get
    End Property

    Public ReadOnly Property MinChoiceSelection() As Integer Implements ISubCartItem.MinChoiceSelection
        Get
            Return m_gwyFeature.MinChoiceSelection
        End Get
    End Property

    Public ReadOnly Property MaxChoiceSelection() As Integer Implements ISubCartItem.MaxChoiceSelection
        Get
            Return m_gwyFeature.MaxChoiceSelection
        End Get
    End Property

    Public ReadOnly Property MinSelection() As Integer Implements ISubCartItem.MinSelection
        Get
            Return m_gwyFeature.MinSelection
        End Get
    End Property

    Public ReadOnly Property MaxSelection() As Integer Implements ISubCartItem.MaxSelection
        Get
            Return m_gwyFeature.MaxSelection
        End Get
    End Property

    Private ReadOnly Property Quantity() As Integer Implements ISubCartItem.Quantity
        Get
            Return m_selectionQuantity
        End Get
    End Property

    Public Property QuantitySelected() As Integer
        Get
            Return m_selectionQuantity
        End Get
        Set(ByVal value As Integer)
            m_selectionQuantity = value
        End Set
    End Property

    Private ReadOnly Property CustomizationText() As String Implements ISubCartItem.Text
        Get
            Return m_gwyFeature.Text
        End Get
    End Property

    Public Property Text() As String
        Get
            Return m_gwyFeature.Text
        End Get
        Set(ByVal value As String)
            m_gwyFeature.Text = value
        End Set
    End Property

    Public ReadOnly Property MaxLength() As Integer Implements ISubCartItem.MaxLength
        Get
            Return m_gwyFeature.MaxLength
        End Get
    End Property

    Private Property Selected() As Boolean Implements ISubCartItem.IsSelected
        Get
            Return m_gwyFeature.IsSelected
        End Get
        Set(ByVal value As Boolean)
            m_gwyFeature.IsSelected = value
        End Set
    End Property

    Public Property ISSelected() As Boolean
        Get
            Return m_gwyFeature.IsSelected
        End Get
        Set(ByVal value As Boolean)
            m_gwyFeature.IsSelected = value
        End Set
    End Property

    Private ReadOnly Property Available() As Boolean Implements ISubCartItem.IsAvailable
        Get
            Return m_available
        End Get
    End Property

    Public Property IsAvailable() As Boolean
        Get
            Return m_available
        End Get
        Set(ByVal value As Boolean)
            m_available = value
        End Set
    End Property

    Private ReadOnly Property Removable() As Boolean Implements ISubCartItem.IsRemovable
        Get
            Return m_removable
        End Get
    End Property

    Public Property ISRemovable() As Boolean
        Get
            Return m_removable
        End Get
        Set(ByVal value As Boolean)
            m_removable = value
        End Set
    End Property

    Public ReadOnly Property IsVisible() As Boolean Implements ISubCartItem.IsVisisble
        Get
            Return m_visible
        End Get
    End Property

    Public WriteOnly Property Visible() As Boolean
        Set(ByVal value As Boolean)
            m_visible = value
        End Set
    End Property

    Public ReadOnly Property Choices() As Dictionary(Of String, ISubCartItem) Implements ISubCartItem.Children
        Get
            If m_children Is Nothing Then
                m_children = New Dictionary(Of String, ISubCartItem)
                If Not m_gwyFeature.Choices Is Nothing Then
                    For Each c As Feature In m_gwyFeature.Choices.Values
                        Dim objBLChoice As New BLFeature(c)
                        m_children.Add(objBLChoice.ID, objBLChoice)
                    Next
                End If
            End If
            Return m_children
        End Get
    End Property

    Public ReadOnly Property ChoicesSelection() As List(Of String) Implements ISubCartItem.SelectedChoices
        Get
            'If m_choiceselection Is Nothing Then
            ' m_choiceSelection = New List(Of String)
            'End If
            'If Not m_gwyFeature.SelectedChoices Is Nothing Then
            '  For Each str As String In m_gwyFeature.SelectedChoices
            '    m_choiceSelection.Add(str)
            '  Next
            'End If
            Return m_selectedChoices
        End Get
    End Property

    Public Property SelectedChoices() As List(Of String)
        Get
            Return m_selectedChoices
        End Get
        Set(ByVal value As List(Of String))
            m_selectedChoices = value
        End Set
    End Property

    'Public ReadOnly Property PromoDisclaimer() As String Implements ISubCartItem.PromotionDisclaimer
    '  Get
    '    Return String.Empty
    '  End Get
    'End Property
End Class
