Option Strict On
Option Explicit On

Imports Nexamas.UI.Architecture
Imports Nexamas.UI.General
Imports Nexamas.UI.Rendering
Imports Nexamas.UI.Theming
Imports SkiaSharp

Namespace Nexamas.UI.Components

    Friend NotInheritable Class ButtonPolicyDefaults

        Private Sub New()
        End Sub

        Friend Shared Function TransparentSurface() As MASButtonSurfaceTheme
            Return New MASButtonSurfaceTheme(
                fillTop:=SKColors.Transparent,
                fillBottom:=SKColors.Transparent,
                borderOuter:=SKColors.Transparent,
                borderInner:=SKColors.Transparent,
                innerHighlight:=SKColors.Transparent,
                innerShade:=SKColors.Transparent,
                materialWash:=SKColors.Transparent,
                bodyGlow:=SKColors.Transparent,
                topSheen:=SKColors.Transparent)
        End Function

        Friend Shared Function EmptyOverlaySpec() As Nexamas.UI.General.MASVisualInteractionOverlaySpec
            Return New Nexamas.UI.General.MASVisualInteractionOverlaySpec With {
                .FillEnabled = False,
                .RingEnabled = False,
                .Fill = SKColors.Transparent,
                .Ring = SKColors.Transparent,
                .FillBlendMode = SKBlendMode.SrcOver,
                .ExtraFillInsetPx = 0.0F,
                .ExtraRingInsetPx = 0.0F,
                .Shape = Nexamas.UI.General.MASVisualInteractionOverlayShape.Closed,
                .State = MASInteractionState.None
            }
        End Function

        Friend Shared Function Has(state As MASInteractionState,
                                   flag As MASInteractionState) As Boolean

            Return (state And flag) = flag

        End Function

        Friend Shared Function DominantState(state As MASInteractionState) As MASInteractionState

            If Has(state, MASInteractionState.Disabled) Then Return MASInteractionState.Disabled
            If Has(state, MASInteractionState.Pressed) Then Return MASInteractionState.Pressed
            If Has(state, MASInteractionState.Selected) Then Return MASInteractionState.Selected
            If Has(state, MASInteractionState.Hovered) Then Return MASInteractionState.Hovered
            If Has(state, MASInteractionState.Focused) Then Return MASInteractionState.Focused

            Return MASInteractionState.None

        End Function

        Friend Shared Function IsInteractive(state As MASInteractionState) As Boolean

            Dim dominant As MASInteractionState = DominantState(state)

            Return dominant <> MASInteractionState.None AndAlso
                   dominant <> MASInteractionState.Disabled

        End Function

    End Class

End Namespace