Option Strict On
Option Explicit On

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-only readiness evidence for MASTreeGrid. It proves that the public
    ''' TreeGrid remains a MAS-owned visual hierarchy/column surface and not a
    ''' storage provider, binding engine, or wrapper over TreeView/DataGrid.
    ''' </summary>
    Friend NotInheritable Class MASTreeGridReadinessManifest
        Friend Sub New(status As MASTreeGridReadinessStatus,
                       hasOfficialVisualSurface As Boolean,
                       hasNoStoragePath As Boolean,
                       hasNoExternalProviderPath As Boolean,
                       hasNoBindingEnginePath As Boolean,
                       hasItemsSourceProjectionPath As Boolean,
                       hasViewportWindowingPath As Boolean,
                       hasSortFilterProjectionPath As Boolean,
                       hasEditingContractPath As Boolean,
                       hasLargeDataWindowingProofPath As Boolean,
                       hasSourceWriteBackAdapterPath As Boolean,
                       hasIncrementalSourceUpdatePath As Boolean,
                       hasNoWrapperPath As Boolean,
                       hasNoVirtualizationEnginePath As Boolean)
            Me.Status = status
            Me.HasOfficialVisualSurface = hasOfficialVisualSurface
            Me.HasNoStoragePath = hasNoStoragePath
            Me.HasNoExternalProviderPath = hasNoExternalProviderPath
            Me.HasNoBindingEnginePath = hasNoBindingEnginePath
            Me.HasItemsSourceProjectionPath = hasItemsSourceProjectionPath
            Me.HasViewportWindowingPath = hasViewportWindowingPath
            Me.HasSortFilterProjectionPath = hasSortFilterProjectionPath
            Me.HasEditingContractPath = hasEditingContractPath
            Me.HasLargeDataWindowingProofPath = hasLargeDataWindowingProofPath
            Me.HasSourceWriteBackAdapterPath = hasSourceWriteBackAdapterPath
            Me.HasIncrementalSourceUpdatePath = hasIncrementalSourceUpdatePath
            Me.HasNoWrapperPath = hasNoWrapperPath
            Me.HasNoVirtualizationEnginePath = hasNoVirtualizationEnginePath
        End Sub

        Friend ReadOnly Property Status As MASTreeGridReadinessStatus
        Friend ReadOnly Property HasOfficialVisualSurface As Boolean
        Friend ReadOnly Property HasNoStoragePath As Boolean
        Friend ReadOnly Property HasNoExternalProviderPath As Boolean
        Friend ReadOnly Property HasNoBindingEnginePath As Boolean
        Friend ReadOnly Property HasItemsSourceProjectionPath As Boolean
        Friend ReadOnly Property HasViewportWindowingPath As Boolean
        Friend ReadOnly Property HasSortFilterProjectionPath As Boolean
        Friend ReadOnly Property HasEditingContractPath As Boolean
        Friend ReadOnly Property HasLargeDataWindowingProofPath As Boolean
        Friend ReadOnly Property HasSourceWriteBackAdapterPath As Boolean
        Friend ReadOnly Property HasIncrementalSourceUpdatePath As Boolean
        Friend ReadOnly Property HasNoWrapperPath As Boolean
        Friend ReadOnly Property HasNoVirtualizationEnginePath As Boolean

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Status = MASTreeGridReadinessStatus.Ready AndAlso
                       HasOfficialVisualSurface AndAlso
                       HasNoStoragePath AndAlso
                       HasNoExternalProviderPath AndAlso
                       HasNoBindingEnginePath AndAlso
                       HasItemsSourceProjectionPath AndAlso
                       HasViewportWindowingPath AndAlso
                       HasSortFilterProjectionPath AndAlso
                       HasEditingContractPath AndAlso
                       HasLargeDataWindowingProofPath AndAlso
                       HasSourceWriteBackAdapterPath AndAlso
                       HasIncrementalSourceUpdatePath AndAlso
                       HasNoWrapperPath AndAlso
                       HasNoVirtualizationEnginePath
            End Get
        End Property


        Friend ReadOnly Property CommercialReadinessFamily As String
            Get
                Return "TreeGridProductControls"
            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 after targeted TreeGrid promotion: stable-keyed hierarchical source projection, bounded row-window proof, sort/filter projection, row label/value editing lifecycle, Friend-only source write-back adapter, incremental add/remove/replace source updates with selection/expanded-state preservation, benchmark baseline/threshold policy, documentation/sample boundary, and final promotion evidence are governed."
            End Get
        End Property

        Friend Shared Function CreateDefault() As MASTreeGridReadinessManifest
            Dim officialSurface As Boolean = MASTreeGridPolicy.HasOfficialVisualSurface() AndAlso MASTreeGridPolicy.HasCachedProjectionPath()
            Dim noStorage As Boolean = MASTreeGridPolicy.HasNoStoragePath()
            Dim noProvider As Boolean = MASTreeGridPolicy.HasNoExternalProviderPath()
            Dim noBinding As Boolean = MASTreeGridPolicy.HasNoBindingEnginePath()
            Dim hasItemsSourceProjection As Boolean = MASTreeGridPolicy.HasItemsSourceProjectionPath()
            Dim hasViewportWindowing As Boolean = MASTreeGridPolicy.HasViewportWindowingPath()
            Dim hasSortFilterProjection As Boolean = MASTreeGridPolicy.HasSortFilterProjectionPath()
            Dim hasEditingContract As Boolean = MASTreeGridPolicy.HasEditingContractPath()
            Dim hasLargeDataWindowing As Boolean = MASTreeGridPolicy.HasLargeDataWindowingProofPath()
            Dim hasSourceWriteBack As Boolean = MASTreeGridPolicy.HasSourceWriteBackAdapterPath()
            Dim hasIncrementalSourceUpdates As Boolean = MASTreeGridPolicy.HasIncrementalSourceUpdatePath()
            Dim noWrapper As Boolean = MASTreeGridPolicy.HasNoTreeViewDataGridWrapperPath()
            Dim noVirtualization As Boolean = MASTreeGridPolicy.HasNoVirtualizationEnginePath()
            Dim status As MASTreeGridReadinessStatus = MASTreeGridReadinessStatus.Ready
            If Not officialSurface Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not noStorage Then status = MASTreeGridReadinessStatus.BlockedByStorageLeak
            If Not noProvider Then status = MASTreeGridReadinessStatus.BlockedByExternalProviderLeak
            If Not noBinding Then status = MASTreeGridReadinessStatus.BlockedByBindingEngineLeak
            If Not hasItemsSourceProjection Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not hasViewportWindowing Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not hasSortFilterProjection Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not hasEditingContract Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not hasLargeDataWindowing Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not hasSourceWriteBack Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not hasIncrementalSourceUpdates Then status = MASTreeGridReadinessStatus.IncompleteEvidence
            If Not noWrapper Then status = MASTreeGridReadinessStatus.BlockedByWrapperLeak
            If Not noVirtualization Then status = MASTreeGridReadinessStatus.BlockedByVirtualizationEngineLeak
            Return New MASTreeGridReadinessManifest(status, officialSurface, noStorage, noProvider, noBinding, hasItemsSourceProjection, hasViewportWindowing, hasSortFilterProjection, hasEditingContract, hasLargeDataWindowing, hasSourceWriteBack, hasIncrementalSourceUpdates, noWrapper, noVirtualization)
        End Function
    End Class

End Namespace
