Option Strict On
Option Explicit On

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-only readiness evidence for MASAgendaView. It proves that this element
    ''' is a visual agenda surface and not a calendar provider, recurrence engine,
    ''' reminder transport, booking database, or scheduler engine.
    ''' </summary>
    Friend NotInheritable Class MASAgendaViewReadinessManifest
        Friend Sub New(status As MASAgendaViewReadinessStatus,
                       hasOfficialSurfaceRoute As Boolean,
                       hasNoRecurrenceEnginePath As Boolean,
                       hasNoReminderTransportPath As Boolean,
                       hasNoExternalCalendarProviderPath As Boolean,
                       hasNoBookingStoragePath As Boolean,
                       hasNoSchedulerEnginePath As Boolean,
                       hasOverlapLayoutPath As Boolean,
                       hasDeterministicNowProviderPath As Boolean,
                       hasSingleDayTimeWindowPath As Boolean,
                       hasEventDayOwnershipPath As Boolean,
                       hasWeekMonthRangeViewPath As Boolean,
                       hasAgendaSourceProjectionPath As Boolean,
                       hasVisibleRangeWindowingProofPath As Boolean,
                       hasRecurrenceTimeZonePolicyPath As Boolean,
                       hasEventMoveResizeContractPath As Boolean)
            Me.Status = status
            Me.HasOfficialSurfaceRoute = hasOfficialSurfaceRoute
            Me.HasNoRecurrenceEnginePath = hasNoRecurrenceEnginePath
            Me.HasNoReminderTransportPath = hasNoReminderTransportPath
            Me.HasNoExternalCalendarProviderPath = hasNoExternalCalendarProviderPath
            Me.HasNoBookingStoragePath = hasNoBookingStoragePath
            Me.HasNoSchedulerEnginePath = hasNoSchedulerEnginePath
            Me.HasOverlapLayoutPath = hasOverlapLayoutPath
            Me.HasDeterministicNowProviderPath = hasDeterministicNowProviderPath
            Me.HasSingleDayTimeWindowPath = hasSingleDayTimeWindowPath
            Me.HasEventDayOwnershipPath = hasEventDayOwnershipPath
            Me.HasWeekMonthRangeViewPath = hasWeekMonthRangeViewPath
            Me.HasAgendaSourceProjectionPath = hasAgendaSourceProjectionPath
            Me.HasVisibleRangeWindowingProofPath = hasVisibleRangeWindowingProofPath
            Me.HasRecurrenceTimeZonePolicyPath = hasRecurrenceTimeZonePolicyPath
            Me.HasEventMoveResizeContractPath = hasEventMoveResizeContractPath
        End Sub

        Friend ReadOnly Property Status As MASAgendaViewReadinessStatus
        Friend ReadOnly Property HasOfficialSurfaceRoute As Boolean
        Friend ReadOnly Property HasNoRecurrenceEnginePath As Boolean
        Friend ReadOnly Property HasNoReminderTransportPath As Boolean
        Friend ReadOnly Property HasNoExternalCalendarProviderPath As Boolean
        Friend ReadOnly Property HasNoBookingStoragePath As Boolean
        Friend ReadOnly Property HasNoSchedulerEnginePath As Boolean
        Friend ReadOnly Property HasOverlapLayoutPath As Boolean
        Friend ReadOnly Property HasDeterministicNowProviderPath As Boolean
        Friend ReadOnly Property HasSingleDayTimeWindowPath As Boolean
        Friend ReadOnly Property HasEventDayOwnershipPath As Boolean
        Friend ReadOnly Property HasWeekMonthRangeViewPath As Boolean
        Friend ReadOnly Property HasAgendaSourceProjectionPath As Boolean
        Friend ReadOnly Property HasVisibleRangeWindowingProofPath As Boolean
        Friend ReadOnly Property HasRecurrenceTimeZonePolicyPath As Boolean
        Friend ReadOnly Property HasEventMoveResizeContractPath As Boolean

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


        Friend ReadOnly Property CommercialReadinessFamily As String
            Get
                Return "AgendaProductControls"
            End Get
        End Property

        Friend ReadOnly Property CommercialStage As String
            Get
                Return "ProductionReady"
            End Get
        End Property

        Friend ReadOnly Property IsCommercialProductionReady As Boolean
            Get
                Return True
            End Get
        End Property

        Friend ReadOnly Property CommercialReadinessNote As String
            Get
                Return "ProductionReady agenda visual surface: event-day ownership, deterministic now-provider, single-day timed overlap layout, week/month range views, internal source projection, bounded visible-range windowing, recurrence/time-zone visual boundary policy, and Friend-only event move/resize contracts are closed without opening recurrence engines, reminder transports, external calendar providers, booking storage, scheduler engines, or public provider APIs."
            End Get
        End Property

        Friend Shared Function CreateDefault() As MASAgendaViewReadinessManifest
            Dim officialSurface As Boolean = True
            Dim noRecurrence As Boolean = MASAgendaViewPolicy.HasNoRecurrenceEnginePath()
            Dim noReminder As Boolean = MASAgendaViewPolicy.HasNoReminderTransportPath()
            Dim noProvider As Boolean = MASAgendaViewPolicy.HasNoExternalCalendarProviderPath()
            Dim noStorage As Boolean = MASAgendaViewPolicy.HasNoBookingStoragePath()
            Dim noScheduler As Boolean = MASAgendaViewPolicy.HasNoSchedulerEnginePath()
            Dim overlapLayout As Boolean = MASAgendaViewPolicy.HasOverlapLayoutPath()
            Dim nowProvider As Boolean = MASAgendaViewPolicy.HasDeterministicNowProviderPath()
            Dim singleDayWindow As Boolean = MASAgendaViewPolicy.HasSingleDayTimeWindowPath()
            Dim eventDayOwnership As Boolean = MASAgendaViewPolicy.HasEventDayOwnershipPath()
            Dim weekMonthRange As Boolean = MASAgendaViewPolicy.HasWeekMonthRangeViewPath()
            Dim sourceProjection As Boolean = MASAgendaViewPolicy.HasAgendaSourceProjectionPath()
            Dim visibleRangeWindowing As Boolean = MASAgendaViewPolicy.HasVisibleRangeWindowingProofPath()
            Dim recurrenceTimeZonePolicy As Boolean = MASAgendaViewPolicy.HasRecurrenceTimeZonePolicyPath() AndAlso MASAgendaViewRecurrenceTimeZoneGate.Passes()
            Dim eventMoveResizeContract As Boolean = MASAgendaViewPolicy.HasEventMoveResizeContractPath() AndAlso MASAgendaViewEventMoveResizeGate.Passes()
            Dim status As MASAgendaViewReadinessStatus = MASAgendaViewReadinessStatus.Ready
            If Not officialSurface OrElse Not overlapLayout OrElse Not nowProvider OrElse Not singleDayWindow OrElse Not eventDayOwnership OrElse Not weekMonthRange OrElse Not sourceProjection OrElse Not visibleRangeWindowing OrElse Not recurrenceTimeZonePolicy OrElse Not eventMoveResizeContract Then status = MASAgendaViewReadinessStatus.IncompleteEvidence
            If Not noRecurrence Then status = MASAgendaViewReadinessStatus.BlockedByRecurrenceEngineLeak
            If Not noReminder Then status = MASAgendaViewReadinessStatus.BlockedByReminderTransportLeak
            If Not noProvider Then status = MASAgendaViewReadinessStatus.BlockedByExternalCalendarProviderLeak
            If Not noStorage Then status = MASAgendaViewReadinessStatus.BlockedByBookingStorageLeak
            If Not noScheduler Then status = MASAgendaViewReadinessStatus.BlockedBySchedulerEngineLeak
            Return New MASAgendaViewReadinessManifest(
                status:=status,
                hasOfficialSurfaceRoute:=officialSurface,
                hasNoRecurrenceEnginePath:=noRecurrence,
                hasNoReminderTransportPath:=noReminder,
                hasNoExternalCalendarProviderPath:=noProvider,
                hasNoBookingStoragePath:=noStorage,
                hasNoSchedulerEnginePath:=noScheduler,
                hasOverlapLayoutPath:=overlapLayout,
                hasDeterministicNowProviderPath:=nowProvider,
                hasSingleDayTimeWindowPath:=singleDayWindow,
                hasEventDayOwnershipPath:=eventDayOwnership,
                hasWeekMonthRangeViewPath:=weekMonthRange,
                hasAgendaSourceProjectionPath:=sourceProjection,
                hasVisibleRangeWindowingProofPath:=visibleRangeWindowing,
                hasRecurrenceTimeZonePolicyPath:=recurrenceTimeZonePolicy,
                hasEventMoveResizeContractPath:=eventMoveResizeContract)
        End Function
    End Class

End Namespace
