Option Strict On
Option Explicit On

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-only readiness evidence for MASChartLegend. It records that the
    ''' control is an official Nexamas UI visual legend surface and not a chart
    ''' renderer, analytics engine, provider, storage path, or mouse-click focus
    ''' ring source.
    ''' </summary>
    Friend NotInheritable Class MASChartLegendReadinessManifest
        Friend Sub New(status As MASChartLegendReadinessStatus,
                       officialLegendSurface As Boolean,
                       hasNoChartRendererPath As Boolean,
                       hasNoAnalyticsPath As Boolean,
                       hasNoProviderPath As Boolean,
                       hasNoStoragePath As Boolean,
                       mouseFocusRingSuppressed As Boolean)
            Me.Status = status
            Me.OfficialLegendSurface = officialLegendSurface
            Me.HasNoChartRendererPath = hasNoChartRendererPath
            Me.HasNoAnalyticsPath = hasNoAnalyticsPath
            Me.HasNoProviderPath = hasNoProviderPath
            Me.HasNoStoragePath = hasNoStoragePath
            Me.MouseFocusRingSuppressed = mouseFocusRingSuppressed
        End Sub

        Friend ReadOnly Property Status As MASChartLegendReadinessStatus
        Friend ReadOnly Property OfficialLegendSurface As Boolean
        Friend ReadOnly Property HasNoChartRendererPath As Boolean
        Friend ReadOnly Property HasNoAnalyticsPath As Boolean
        Friend ReadOnly Property HasNoProviderPath As Boolean
        Friend ReadOnly Property HasNoStoragePath As Boolean
        Friend ReadOnly Property MouseFocusRingSuppressed As Boolean

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Status = MASChartLegendReadinessStatus.Ready AndAlso
                       OfficialLegendSurface AndAlso
                       HasNoChartRendererPath AndAlso
                       HasNoAnalyticsPath AndAlso
                       HasNoProviderPath AndAlso
                       HasNoStoragePath AndAlso
                       MouseFocusRingSuppressed
            End Get
        End Property

        Friend Shared Function CreateDefault() As MASChartLegendReadinessManifest
            Dim official As Boolean = True
            Dim noRenderer As Boolean = MASChartLegendPolicy.HasNoChartRendererPath()
            Dim noAnalytics As Boolean = MASChartLegendPolicy.HasNoAnalyticsPath()
            Dim noProvider As Boolean = MASChartLegendPolicy.HasNoProviderPath()
            Dim noStorage As Boolean = MASChartLegendPolicy.HasNoStoragePath()
            Dim focusSuppressed As Boolean = MASChartLegendPolicy.HasMouseFocusRingSuppressed()
            Dim status As MASChartLegendReadinessStatus = MASChartLegendReadinessStatus.Ready
            If Not official Then status = MASChartLegendReadinessStatus.IncompleteEvidence
            If Not noRenderer Then status = MASChartLegendReadinessStatus.BlockedByChartRendererLeak
            If Not noAnalytics Then status = MASChartLegendReadinessStatus.BlockedByAnalyticsLeak
            If Not noProvider Then status = MASChartLegendReadinessStatus.BlockedByProviderLeak
            If Not noStorage Then status = MASChartLegendReadinessStatus.BlockedByStorageLeak
            If Not focusSuppressed Then status = MASChartLegendReadinessStatus.BlockedByMouseFocusRingLeak
            Return New MASChartLegendReadinessManifest(status, official, noRenderer, noAnalytics, noProvider, noStorage, focusSuppressed)
        End Function
    End Class

End Namespace
