Option Strict On
Option Explicit On

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-only readiness evidence for the Rating element. It records that this
    ''' stage owns a visual rating surface only; review storage, analytics,
    ''' feedback submission, moderation, persistence, and recommendation scoring
    ''' remain outside the control.
    ''' </summary>
    Friend NotInheritable Class MASRatingReadinessManifest
        Friend Sub New(status As MASRatingReadinessStatus,
                       hasOfficialControlSurface As Boolean,
                       hasNoReviewStoragePath As Boolean,
                       hasNoAnalyticsPath As Boolean,
                       hasNoFeedbackSubmissionPath As Boolean,
                       hasNoPersistencePath As Boolean,
                       hasNoRecommendationModelPath As Boolean)
            Me.Status = status
            Me.HasOfficialControlSurface = hasOfficialControlSurface
            Me.HasNoReviewStoragePath = hasNoReviewStoragePath
            Me.HasNoAnalyticsPath = hasNoAnalyticsPath
            Me.HasNoFeedbackSubmissionPath = hasNoFeedbackSubmissionPath
            Me.HasNoPersistencePath = hasNoPersistencePath
            Me.HasNoRecommendationModelPath = hasNoRecommendationModelPath
        End Sub

        Friend ReadOnly Property Status As MASRatingReadinessStatus
        Friend ReadOnly Property HasOfficialControlSurface As Boolean
        Friend ReadOnly Property HasNoReviewStoragePath As Boolean
        Friend ReadOnly Property HasNoAnalyticsPath As Boolean
        Friend ReadOnly Property HasNoFeedbackSubmissionPath As Boolean
        Friend ReadOnly Property HasNoPersistencePath As Boolean
        Friend ReadOnly Property HasNoRecommendationModelPath As Boolean

        Friend Shared Function CreateDefault() As MASRatingReadinessManifest
            Dim officialSurface As Boolean = True
            Dim noStorage As Boolean = MASRatingPolicy.HasNoReviewStoragePath()
            Dim noAnalytics As Boolean = MASRatingPolicy.HasNoAnalyticsPath()
            Dim noSubmission As Boolean = MASRatingPolicy.HasNoFeedbackSubmissionPath()
            Dim noPersistence As Boolean = MASRatingPolicy.HasNoPersistencePath()
            Dim noRecommendation As Boolean = MASRatingPolicy.HasNoRecommendationModelPath()
            Dim status As MASRatingReadinessStatus = MASRatingReadinessStatus.Ready

            If Not officialSurface OrElse Not noPersistence OrElse Not noRecommendation Then status = MASRatingReadinessStatus.IncompleteEvidence
            If Not noStorage Then status = MASRatingReadinessStatus.BlockedByReviewStorageLeak
            If Not noAnalytics Then status = MASRatingReadinessStatus.BlockedByAnalyticsLeak
            If Not noSubmission Then status = MASRatingReadinessStatus.BlockedByFeedbackSubmissionLeak

            Return New MASRatingReadinessManifest(
                status:=status,
                hasOfficialControlSurface:=officialSurface,
                hasNoReviewStoragePath:=noStorage,
                hasNoAnalyticsPath:=noAnalytics,
                hasNoFeedbackSubmissionPath:=noSubmission,
                hasNoPersistencePath:=noPersistence,
                hasNoRecommendationModelPath:=noRecommendation)
        End Function
    End Class

End Namespace
