Option Strict On
Option Explicit On

Namespace Nexamas.UI.ThemeStudio

    ''' <summary>
    ''' Product-safe description of one profile assignment from a generic slot to an official
    ''' surface material. It lets Designer/Showcase display the slot matrix without exposing the
    ''' mutable profile registry or renderer internals.
    ''' </summary>
    Friend NotInheritable Class MASSurfaceDesignerMaterialProfileAssignmentEntry

        Friend Sub New(slotName As String,
                       slotValue As Integer,
                       materialId As String,
                       materialDisplayName As String,
                       isNativeMaterial As Boolean,
                       frameKey As String,
                       frameStrengthName As String,
                       surfaceStrengthLevel As Integer)
            Me.SlotName = Normalize(slotName)
            Me.SlotValue = slotValue
            Me.MaterialId = Normalize(materialId)
            Me.MaterialDisplayName = Normalize(materialDisplayName)
            Me.IsNativeMaterial = isNativeMaterial
            Me.FrameKey = Normalize(frameKey)
            Me.FrameStrengthName = Normalize(frameStrengthName)
            Me.SurfaceStrengthLevel = Clamp(surfaceStrengthLevel, 1, 6)
        End Sub

        Friend ReadOnly Property SlotName As String
        Friend ReadOnly Property SlotValue As Integer
        Friend ReadOnly Property MaterialId As String
        Friend ReadOnly Property MaterialDisplayName As String
        Friend ReadOnly Property IsNativeMaterial As Boolean
        Friend ReadOnly Property FrameKey As String
        Friend ReadOnly Property FrameStrengthName As String
        Friend ReadOnly Property SurfaceStrengthLevel As Integer

        Friend ReadOnly Property IsThemeAware As Boolean
            Get
                Return Not IsNativeMaterial
            End Get
        End Property

        Private Shared Function Normalize(value As String) As String
            Return If(value, String.Empty).Trim()
        End Function

        Private Shared Function Clamp(value As Integer, minimum As Integer, maximum As Integer) As Integer
            If value < minimum Then Return minimum
            If value > maximum Then Return maximum
            Return value
        End Function

    End Class

End Namespace
