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


<Serializable()> _
Public Class BLServicePlan
    Implements ICartItem, ISubCartItem

    Public m_gwySP As ServicePlan
    Private m_serviceType As ServiceType
    Private m_children As Dictionary(Of String, ISubCartItem)
    Private m_selected As Boolean = False
    Private m_available As Boolean = True
    Private m_removable As Boolean = True
    Private m_visible As Boolean = True

    'Private m_installDescription As String

    Public Sub New(ByVal sp As ServicePlan)
        m_gwySP = sp
    End Sub

    Public ReadOnly Property ID() As String Implements ICartItem.ID, ISubCartItem.ID
        Get
            Return ItemType.ServicePlan & m_gwySP.ID
        End Get
    End Property

    Public ReadOnly Property Name() As String Implements ICartItem.Name, ISubCartItem.Name
        Get
            Return m_gwySP.Name
        End Get
    End Property

    Public ReadOnly Property Description() As String Implements ICartItem.Description, ISubCartItem.Description
        Get
            Return m_gwySP.Description
        End Get
    End Property

    Public ReadOnly Property InstallPrice() As Decimal Implements ICartItem.InstallPrice, ISubCartItem.InstallPrice
        Get
            Return m_gwySP.InstallPrice
        End Get
    End Property

    Public ReadOnly Property InstallDescription() As String Implements ICartItem.InstallDescription, ISubCartItem.InstallDescription
        Get
            Return m_gwySP.InstallDescription
        End Get
    End Property

    Public ReadOnly Property ContractDescription() As String Implements ICartItem.ContractDescription
        Get
            Return m_gwySP.ContractDescription
        End Get
    End Property

    Public ReadOnly Property ContractTermsAndConditions() As String Implements ICartItem.ContractTermsAndConditions
        Get
            Return m_gwySP.ContractTermsAndConditions
        End Get
    End Property

    Public Property Requirements() As String Implements ICartItem.Requirements
        Get
            Return m_gwySP.Requirements
        End Get
        Set(ByVal value As String)

        End Set
    End Property

    Public ReadOnly Property Type() As ItemType Implements ICartItem.Type, ISubCartItem.Type
        Get
            Return ItemType.ServicePlan
        End Get
    End Property

    Public ReadOnly Property Category() As Category Implements ICartItem.Category, ISubCartItem.Category
        Get
            Return Common.ConvertToUICategory(m_gwySP.Category)
        End Get
    End Property

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

    Private ReadOnly Property InputType() As InputType Implements ISubCartItem.InputType
        Get
            Return InputType.Other
        End Get
    End Property

    ' these properties are not used they are here just because they are in ISubcartItem
    Private Property SPPrice() As Decimal Implements ICartItem.Price, ISubCartItem.Price
        Get
            Return m_gwySP.Price
        End Get
        Set(ByVal value As Decimal)
            m_gwySP.Price = value
        End Set
    End Property

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

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

    Private ReadOnly Property MaxLength() As Integer Implements ISubCartItem.MaxLength
        Get
            Return 0
        End Get
    End Property

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

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

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

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

    'Public ReadOnly Property PriceFrequency() As PriceFrequency
    '  Get
    '    Return m_gwySP.PriceFrequency
    '  End Get
    'End Property

    Private ReadOnly Property FeatureType() As FeatureType Implements ISubCartItem.FeatureType
        Get
            Return FeatureType.NotSpecified
        End Get
    End Property

    Private ReadOnly Property SelectedChoices() As List(Of String) Implements ISubCartItem.SelectedChoices
        Get
            Return New List(Of String)
        End Get
    End Property

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

    Public Property IsSelected() As Boolean
        Get
            Return m_selected
        End Get
        Set(ByVal value As Boolean)
            m_selected = value
        End Set
    End Property

    Private ReadOnly Property Available() As Boolean Implements ICartItem.IsAvailable, 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

    Public ReadOnly Property IsVisible() As Boolean Implements ICartItem.IsVisisble, 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 Features() As Dictionary(Of String, ISubCartItem) Implements ICartItem.Children, ISubCartItem.Children
        Get
            If m_children Is Nothing Then
                m_children = New Dictionary(Of String, ISubCartItem)
                For Each f As Feature In m_gwySP.Features.Values
                    Dim objBLfeature As New BLFeature(f)
                    m_children.Add(objBLfeature.ID, objBLfeature)
                Next
            End If
            Return m_children
        End Get
    End Property

    Public ReadOnly Property Removable() As Boolean Implements ICartItem.IsRemovable, 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

    Private ReadOnly Property MinChoiceSelection() As Integer Implements ISubCartItem.MinChoiceSelection
        Get
            Return 0
        End Get
    End Property

    Private ReadOnly Property MinSelection() As Integer Implements ISubCartItem.MinSelection
        Get
            Return 0
        End Get
    End Property

    Private ReadOnly Property MaxChoiceSelection() As Integer Implements ISubCartItem.MaxChoiceSelection
        Get
            Return 0
        End Get
    End Property

    Private ReadOnly Property MaxSelection() As Integer Implements ISubCartItem.MaxSelection
        Get
            Return 0
        End Get
    End Property

    Public ReadOnly Property PromotionName() As String Implements ICartItem.PromotionName
        Get
            Return m_gwySP.PromoName
        End Get
    End Property

    Public ReadOnly Property PromoDisclaimer() As String Implements ICartItem.PromotionDisclaimer
        Get
            Return m_gwySP.PromoDisclaimer
        End Get
    End Property

    Public ReadOnly Property MarketingInfo() As String Implements ICartItem.MarketingInfo
        Get
            Return m_gwySP.MarketingInfo
        End Get
    End Property

    Public ReadOnly Property MarketingDetail() As String Implements ICartItem.MarketingDetail
        Get
            Return m_gwySP.MarketingDetail
        End Get
    End Property
End Class
