Option Strict On
Option Explicit On

Imports System
Imports Nexamas.UI.Values
Imports Nexamas.UI.Rendering

Namespace Nexamas.UI.Components

    ''' <summary>
    ''' Friend-owned premium profile for the existing MASToolbar CommandBar route.
    ''' It centralizes the command-bar density, item geometry, surface material,
    ''' and readiness facts without creating a public MASCommandBar wrapper.
    ''' </summary>
    Friend NotInheritable Class MASCommandBarPremiumProfile

        Friend Sub New(horizontalPaddingDip As Single,
                       verticalInsetDip As Single,
                       gapDip As Single,
                       itemHeightDip As Single,
                       iconButtonWidthDip As Single,
                       separatorWidthDip As Single,
                       surfaceMaterialKey As String)
            Me.HorizontalPaddingDip = Math.Max(0.0F, horizontalPaddingDip)
            Me.VerticalInsetDip = Math.Max(0.0F, verticalInsetDip)
            Me.GapDip = Math.Max(0.0F, gapDip)
            Me.ItemHeightDip = Math.Max(ToolbarTokens.ItemMinHeight, itemHeightDip)
            Me.IconButtonWidthDip = Math.Max(1.0F, iconButtonWidthDip)
            Me.SeparatorWidthDip = Math.Max(1.0F, separatorWidthDip)
            Me.SurfaceMaterialKey = MASSurfaceTreatmentMaterialKeyNormalizer.NormalizeForStorage(surfaceMaterialKey)
        End Sub

        Friend ReadOnly Property HorizontalPaddingDip As Single
        Friend ReadOnly Property VerticalInsetDip As Single
        Friend ReadOnly Property GapDip As Single
        Friend ReadOnly Property ItemHeightDip As Single
        Friend ReadOnly Property IconButtonWidthDip As Single
        Friend ReadOnly Property SeparatorWidthDip As Single
        Friend ReadOnly Property SurfaceMaterialKey As String

        Friend ReadOnly Property HasPremiumDensity As Boolean
            Get
                Return HorizontalPaddingDip >= ToolbarTokens.CommandBarHorizontalPadding AndAlso
                       ItemHeightDip >= ToolbarTokens.CommandBarItemHeight AndAlso
                       IconButtonWidthDip >= ToolbarTokens.CommandBarIconButtonWidth
            End Get
        End Property

        Friend ReadOnly Property UsesOfficialSurfaceMaterialRoute As Boolean
            Get
                Return SurfaceMaterialKey.Length > 0
            End Get
        End Property

        Friend ReadOnly Property ReadyForPremiumCommandBar As Boolean
            Get
                Return HasPremiumDensity AndAlso UsesOfficialSurfaceMaterialRoute
            End Get
        End Property

        Friend Shared Function CreateDefault() As MASCommandBarPremiumProfile
            Return New MASCommandBarPremiumProfile(
                horizontalPaddingDip:=ToolbarTokens.CommandBarHorizontalPadding,
                verticalInsetDip:=ToolbarTokens.CommandBarVerticalInset,
                gapDip:=ToolbarTokens.CommandBarGap,
                itemHeightDip:=ToolbarTokens.CommandBarItemHeight,
                iconButtonWidthDip:=ToolbarTokens.CommandBarIconButtonWidth,
                separatorWidthDip:=ToolbarTokens.CommandBarSeparatorWidth,
                surfaceMaterialKey:=MASSurfaceMaterialIds.Auto)
        End Function

    End Class

End Namespace
