Option Strict On
Option Explicit On

Namespace Nexamas.UI.Rendering

    ''' <summary>
    ''' VisualSurface policy profile for a material treatment.
    ''' It pairs the material with a recommended frame and a theme-influence policy
    ''' without introducing a second frame system or changing existing drawing.
    ''' </summary>
    Friend NotInheritable Class MASSurfaceTreatmentMaterialProfile

        Friend ReadOnly Property MaterialKey As String
        Friend ReadOnly Property RecommendedFrameKey As String
        Friend ReadOnly Property ThemeInfluenceMode As MASSurfaceTreatmentThemeInfluenceMode
        Friend ReadOnly Property IsCompatibilityAlias As Boolean
        Friend ReadOnly Property PreservesMaterialIdentity As Boolean
        Friend ReadOnly Property Notes As String

        Friend Sub New(materialKey As String,
                       recommendedFrameKey As String,
                       themeInfluenceMode As MASSurfaceTreatmentThemeInfluenceMode,
                       isCompatibilityAlias As Boolean,
                       preservesMaterialIdentity As Boolean,
                       notes As String)

            Me.MaterialKey = Normalize(materialKey, MASSurfaceMaterialIds.PlatformDefault)
            Me.RecommendedFrameKey = Normalize(recommendedFrameKey, MASSurfaceFrameIds.PlatformDefault)
            Me.ThemeInfluenceMode = If(themeInfluenceMode = MASSurfaceTreatmentThemeInfluenceMode.Unknown,
                                       MASSurfaceTreatmentThemeInfluenceMode.ThemeBound,
                                       themeInfluenceMode)
            Me.IsCompatibilityAlias = isCompatibilityAlias
            Me.PreservesMaterialIdentity = preservesMaterialIdentity
            Me.Notes = Normalize(notes, String.Empty)
        End Sub

        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
