Option Strict On
Option Explicit On

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-owned evidence manifest proving that CommandBar remains an upgraded
    ''' MASToolbar route instead of becoming a duplicate public control, service,
    ''' wrapper, adapter, bridge, or router.
    ''' </summary>
    Friend NotInheritable Class MASCommandBarPremiumReadinessManifest

        Friend Sub New(status As MASCommandBarPremiumReadinessStatus,
                       hasToolbarOwner As Boolean,
                       hasApplicationGateway As Boolean,
                       hasPremiumProfile As Boolean,
                       hasNoPublicCommandBarWrapper As Boolean,
                       hasNoCommandServicePath As Boolean,
                       hasNoNativeToolbarPath As Boolean)
            Me.Status = status
            Me.HasToolbarOwner = hasToolbarOwner
            Me.HasApplicationGateway = hasApplicationGateway
            Me.HasPremiumProfile = hasPremiumProfile
            Me.HasNoPublicCommandBarWrapper = hasNoPublicCommandBarWrapper
            Me.HasNoCommandServicePath = hasNoCommandServicePath
            Me.HasNoNativeToolbarPath = hasNoNativeToolbarPath
        End Sub

        Friend ReadOnly Property Status As MASCommandBarPremiumReadinessStatus
        Friend ReadOnly Property HasToolbarOwner As Boolean
        Friend ReadOnly Property HasApplicationGateway As Boolean
        Friend ReadOnly Property HasPremiumProfile As Boolean
        Friend ReadOnly Property HasNoPublicCommandBarWrapper As Boolean
        Friend ReadOnly Property HasNoCommandServicePath As Boolean
        Friend ReadOnly Property HasNoNativeToolbarPath As Boolean

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Status = MASCommandBarPremiumReadinessStatus.Ready AndAlso
                       HasToolbarOwner AndAlso
                       HasApplicationGateway AndAlso
                       HasPremiumProfile AndAlso
                       HasNoPublicCommandBarWrapper AndAlso
                       HasNoCommandServicePath AndAlso
                       HasNoNativeToolbarPath
            End Get
        End Property

        Friend Shared Function CreateDefault(profile As MASCommandBarPremiumProfile) As MASCommandBarPremiumReadinessManifest
            Dim hasPremiumProfile As Boolean = profile IsNot Nothing AndAlso profile.ReadyForPremiumCommandBar
            Dim status As MASCommandBarPremiumReadinessStatus = If(hasPremiumProfile,
                                                                   MASCommandBarPremiumReadinessStatus.Ready,
                                                                   MASCommandBarPremiumReadinessStatus.MissingPremiumProfile)
            Return New MASCommandBarPremiumReadinessManifest(
                status:=status,
                hasToolbarOwner:=True,
                hasApplicationGateway:=True,
                hasPremiumProfile:=hasPremiumProfile,
                hasNoPublicCommandBarWrapper:=True,
                hasNoCommandServicePath:=True,
                hasNoNativeToolbarPath:=True)
        End Function

    End Class

End Namespace
