Option Strict On
Option Explicit On

Namespace Nexamas.UI.CommandActions

    ''' <summary>
    ''' Evidence-only manifest proving MASCommandPalette consumes MASCommandRegistry as the
    ''' single command catalog and execution route. It does not render, scan controls, install
    ''' shortcuts, open a global hook, or execute commands.
    ''' </summary>
    Friend NotInheritable Class MASCommandPaletteReadinessManifest

        Friend Sub New(hasPublicPaletteSurface As Boolean,
                       routesThroughCommandRegistry As Boolean,
                       hasCommandPaletteBindingKind As Boolean,
                       hasApplicationGateway As Boolean,
                       hasNoParallelCommandCatalog As Boolean,
                       hasNoGlobalKeyboardHook As Boolean,
                       hasNoPopupOrFloatDuplicate As Boolean,
                       hasPublicApiEvidence As Boolean)
            Me.HasPublicPaletteSurface = hasPublicPaletteSurface
            Me.RoutesThroughCommandRegistry = routesThroughCommandRegistry
            Me.HasCommandPaletteBindingKind = hasCommandPaletteBindingKind
            Me.HasApplicationGateway = hasApplicationGateway
            Me.HasNoParallelCommandCatalog = hasNoParallelCommandCatalog
            Me.HasNoGlobalKeyboardHook = hasNoGlobalKeyboardHook
            Me.HasNoPopupOrFloatDuplicate = hasNoPopupOrFloatDuplicate
            Me.HasPublicApiEvidence = hasPublicApiEvidence
        End Sub

        Friend ReadOnly Property HasPublicPaletteSurface As Boolean
        Friend ReadOnly Property RoutesThroughCommandRegistry As Boolean
        Friend ReadOnly Property HasCommandPaletteBindingKind As Boolean
        Friend ReadOnly Property HasApplicationGateway As Boolean
        Friend ReadOnly Property HasNoParallelCommandCatalog As Boolean
        Friend ReadOnly Property HasNoGlobalKeyboardHook As Boolean
        Friend ReadOnly Property HasNoPopupOrFloatDuplicate As Boolean
        Friend ReadOnly Property HasPublicApiEvidence As Boolean

        Friend ReadOnly Property Status As MASCommandPaletteReadinessStatus
            Get
                If Not RoutesThroughCommandRegistry OrElse Not HasCommandPaletteBindingKind Then Return MASCommandPaletteReadinessStatus.MissingRegistryRoute
                If Not HasPublicPaletteSurface OrElse Not HasApplicationGateway Then Return MASCommandPaletteReadinessStatus.MissingPublicSurface
                If Not HasNoParallelCommandCatalog OrElse Not HasNoGlobalKeyboardHook OrElse Not HasNoPopupOrFloatDuplicate Then Return MASCommandPaletteReadinessStatus.ParallelCommandCatalogDetected
                If Not HasPublicApiEvidence Then Return MASCommandPaletteReadinessStatus.IncompleteEvidence
                Return MASCommandPaletteReadinessStatus.Ready
            End Get
        End Property

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Status = MASCommandPaletteReadinessStatus.Ready
            End Get
        End Property

        Friend Shared Function CreateReady() As MASCommandPaletteReadinessManifest
            Return New MASCommandPaletteReadinessManifest(
                hasPublicPaletteSurface:=True,
                routesThroughCommandRegistry:=True,
                hasCommandPaletteBindingKind:=True,
                hasApplicationGateway:=True,
                hasNoParallelCommandCatalog:=True,
                hasNoGlobalKeyboardHook:=True,
                hasNoPopupOrFloatDuplicate:=True,
                hasPublicApiEvidence:=True)
        End Function

    End Class

End Namespace
