Option Strict On
Option Explicit On

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-only evidence for MASCalendarView. It proves that the public element is
    ''' a governed month-view control and not a scheduler, agenda store, reminder
    ''' service, external provider bridge, or DatePicker popup wrapper.
    ''' </summary>
    Friend NotInheritable Class MASCalendarViewReadinessManifest
        Friend Sub New(name As String,
                       status As MASCalendarViewReadinessStatus,
                       hasArchitectureContract As Boolean,
                       hasApplicationGateway As Boolean,
                       hasThemeSurfaceRoute As Boolean,
                       hasSizeLayoutRoute As Boolean,
                       hasCultureWeekStartRoute As Boolean,
                       hasRtlRoute As Boolean,
                       hasNoAgendaStorePath As Boolean,
                       hasNoSchedulerEnginePath As Boolean,
                       hasNoExternalCalendarProviderPath As Boolean)
            Me.Name = If(name, String.Empty)
            Me.Status = status
            Me.HasArchitectureContract = hasArchitectureContract
            Me.HasApplicationGateway = hasApplicationGateway
            Me.HasThemeSurfaceRoute = hasThemeSurfaceRoute
            Me.HasSizeLayoutRoute = hasSizeLayoutRoute
            Me.HasCultureWeekStartRoute = hasCultureWeekStartRoute
            Me.HasRtlRoute = hasRtlRoute
            Me.HasNoAgendaStorePath = hasNoAgendaStorePath
            Me.HasNoSchedulerEnginePath = hasNoSchedulerEnginePath
            Me.HasNoExternalCalendarProviderPath = hasNoExternalCalendarProviderPath
        End Sub

        Friend ReadOnly Property Name As String
        Friend ReadOnly Property Status As MASCalendarViewReadinessStatus
        Friend ReadOnly Property HasArchitectureContract As Boolean
        Friend ReadOnly Property HasApplicationGateway As Boolean
        Friend ReadOnly Property HasThemeSurfaceRoute As Boolean
        Friend ReadOnly Property HasSizeLayoutRoute As Boolean
        Friend ReadOnly Property HasCultureWeekStartRoute As Boolean
        Friend ReadOnly Property HasRtlRoute As Boolean
        Friend ReadOnly Property HasNoAgendaStorePath As Boolean
        Friend ReadOnly Property HasNoSchedulerEnginePath As Boolean
        Friend ReadOnly Property HasNoExternalCalendarProviderPath As Boolean

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Status = MASCalendarViewReadinessStatus.Ready OrElse
                       Status = MASCalendarViewReadinessStatus.ReadyWithAgendaBoundary
            End Get
        End Property

        Friend Shared Function CreateDefault() As MASCalendarViewReadinessManifest
            Dim noAgenda As Boolean = MASCalendarViewPolicy.HasNoAgendaStorePath()
            Dim noScheduler As Boolean = MASCalendarViewPolicy.HasNoSchedulerEnginePath()
            Dim noProvider As Boolean = MASCalendarViewPolicy.HasNoExternalCalendarProviderPath()

            Dim status As MASCalendarViewReadinessStatus = MASCalendarViewReadinessStatus.Ready
            If Not noScheduler Then status = MASCalendarViewReadinessStatus.BlockedBySchedulerEngine
            If Not noProvider Then status = MASCalendarViewReadinessStatus.BlockedByExternalProvider
            If noAgenda AndAlso status = MASCalendarViewReadinessStatus.Ready Then status = MASCalendarViewReadinessStatus.ReadyWithAgendaBoundary

            Return New MASCalendarViewReadinessManifest(
                name:="MASCalendarView",
                status:=status,
                hasArchitectureContract:=True,
                hasApplicationGateway:=True,
                hasThemeSurfaceRoute:=True,
                hasSizeLayoutRoute:=True,
                hasCultureWeekStartRoute:=True,
                hasRtlRoute:=True,
                hasNoAgendaStorePath:=noAgenda,
                hasNoSchedulerEnginePath:=noScheduler,
                hasNoExternalCalendarProviderPath:=noProvider)
        End Function
    End Class

End Namespace
