Option Strict On
Option Explicit On

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-only readiness evidence for the MetricCard element. It records that
    ''' this stage owns a compact dashboard metric visual only; metric storage,
    ''' analytics collection, telemetry refresh, chart engines, provider sync, and
    ''' dashboard composition remain outside the control.
    ''' </summary>
    Friend NotInheritable Class MASMetricCardReadinessManifest
        Friend Sub New(status As MASMetricCardReadinessStatus,
                       hasOfficialControlSurface As Boolean,
                       hasNoMetricStoragePath As Boolean,
                       hasNoAnalyticsCollectionPath As Boolean,
                       hasNoTelemetryRefreshLoop As Boolean,
                       hasNoChartEnginePath As Boolean,
                       hasNoDashboardCompositionPath As Boolean)
            Me.Status = status
            Me.HasOfficialControlSurface = hasOfficialControlSurface
            Me.HasNoMetricStoragePath = hasNoMetricStoragePath
            Me.HasNoAnalyticsCollectionPath = hasNoAnalyticsCollectionPath
            Me.HasNoTelemetryRefreshLoop = hasNoTelemetryRefreshLoop
            Me.HasNoChartEnginePath = hasNoChartEnginePath
            Me.HasNoDashboardCompositionPath = hasNoDashboardCompositionPath
        End Sub

        Friend ReadOnly Property Status As MASMetricCardReadinessStatus
        Friend ReadOnly Property HasOfficialControlSurface As Boolean
        Friend ReadOnly Property HasNoMetricStoragePath As Boolean
        Friend ReadOnly Property HasNoAnalyticsCollectionPath As Boolean
        Friend ReadOnly Property HasNoTelemetryRefreshLoop As Boolean
        Friend ReadOnly Property HasNoChartEnginePath As Boolean
        Friend ReadOnly Property HasNoDashboardCompositionPath As Boolean

        Friend Shared Function CreateDefault() As MASMetricCardReadinessManifest
            Dim officialSurface As Boolean = True
            Dim noStorage As Boolean = MASMetricCardPolicy.HasNoMetricStoragePath()
            Dim noAnalytics As Boolean = MASMetricCardPolicy.HasNoAnalyticsCollectionPath()
            Dim noTelemetry As Boolean = MASMetricCardPolicy.HasNoTelemetryRefreshLoop()
            Dim noChartEngine As Boolean = MASMetricCardPolicy.HasNoChartEnginePath()
            Dim noDashboardComposition As Boolean = MASMetricCardPolicy.HasNoDashboardCompositionPath()
            Dim status As MASMetricCardReadinessStatus = MASMetricCardReadinessStatus.Ready

            If Not officialSurface OrElse Not noDashboardComposition Then status = MASMetricCardReadinessStatus.IncompleteEvidence
            If Not noStorage Then status = MASMetricCardReadinessStatus.BlockedByMetricStorageLeak
            If Not noAnalytics Then status = MASMetricCardReadinessStatus.BlockedByAnalyticsCollectionLeak
            If Not noTelemetry Then status = MASMetricCardReadinessStatus.BlockedByTelemetryRefreshLoop
            If Not noChartEngine Then status = MASMetricCardReadinessStatus.BlockedByChartEngineLeak

            Return New MASMetricCardReadinessManifest(
                status:=status,
                hasOfficialControlSurface:=officialSurface,
                hasNoMetricStoragePath:=noStorage,
                hasNoAnalyticsCollectionPath:=noAnalytics,
                hasNoTelemetryRefreshLoop:=noTelemetry,
                hasNoChartEnginePath:=noChartEngine,
                hasNoDashboardCompositionPath:=noDashboardComposition)
        End Function
    End Class

End Namespace
