Option Strict On
Option Explicit On

Namespace Nexamas.UI.Rendering

    ''' <summary>
    ''' One immutable ownership row for the Visual lockdown audit.
    ''' It stores responsibility evidence only; it does not inspect files, draw, or mutate runtime state.
    ''' </summary>
    Friend NotInheritable Class MASVisualOwnershipEntry
        Friend ReadOnly Property Area As MASVisualOwnershipArea
        Friend ReadOnly Property AreaName As String
        Friend ReadOnly Property OwnerRoot As String
        Friend ReadOnly Property Responsibility As String
        Friend ReadOnly Property Status As MASVisualOwnershipStatus
        Friend ReadOnly Property HasDedicatedOwner As Boolean
        Friend ReadOnly Property PreservesCurrentVisuals As Boolean
        Friend ReadOnly Property BlocksLegacyThemeRendering As Boolean
        Friend ReadOnly Property BlocksParallelRoute As Boolean
        Friend ReadOnly Property Notes As String

        Friend Sub New(area As MASVisualOwnershipArea,
                       areaName As String,
                       ownerRoot As String,
                       responsibility As String,
                       status As MASVisualOwnershipStatus,
                       hasDedicatedOwner As Boolean,
                       preservesCurrentVisuals As Boolean,
                       blocksLegacyThemeRendering As Boolean,
                       blocksParallelRoute As Boolean,
                       notes As String)
            Me.Area = area
            Me.AreaName = Normalize(areaName, area.ToString())
            Me.OwnerRoot = Normalize(ownerRoot, "MASSystem/Visual")
            Me.Responsibility = Normalize(responsibility, String.Empty)
            Me.Status = status
            Me.HasDedicatedOwner = hasDedicatedOwner
            Me.PreservesCurrentVisuals = preservesCurrentVisuals
            Me.BlocksLegacyThemeRendering = blocksLegacyThemeRendering
            Me.BlocksParallelRoute = blocksParallelRoute
            Me.Notes = Normalize(notes, String.Empty)
        End Sub

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Status = MASVisualOwnershipStatus.Ready AndAlso
                       HasDedicatedOwner AndAlso
                       PreservesCurrentVisuals AndAlso
                       BlocksLegacyThemeRendering AndAlso
                       BlocksParallelRoute
            End Get
        End Property

        Private Shared Function Normalize(value As String, fallback As String) As String
            Dim result As String = If(value, String.Empty).Trim()
            If result.Length = 0 Then Return fallback
            Return result
        End Function
    End Class

End Namespace
