Option Strict On
Option Explicit On

Imports System

Namespace Nexamas.UI.Architecture

    ''' <summary>
    ''' Friend-owned focus-visual policy for large composite content controls.
    ''' Composite controls still need normal pointer focus so their internal hover,
    ''' pressed, captured, selected, and keyboard states keep working after a click.
    ''' The only visual that is suppressed is the broad outer ring around the whole
    ''' surface; active inner rows, cards, chips, days, stars, toolbar buttons, or
    ''' viewport actions remain responsible for visible interaction feedback.
    ''' </summary>
    Friend NotInheritable Class MASCompositeContentFocusPolicy
        Private Sub New()
        End Sub

        Friend Shared Function CanReceiveKeyboardFocus(contract As MASResolvedComponentContract,
                                                       visible As Boolean,
                                                       enabled As Boolean) As Boolean
            If Not visible OrElse Not enabled Then Return False
            If contract Is Nothing Then Throw New ArgumentNullException(NameOf(contract))
            Return MASFocusResolver.CanReceiveKeyboardFocus(contract)
        End Function

        Friend Shared Function AllowsPointerFocusForCompositeContent(contract As MASResolvedComponentContract,
                                                                     visible As Boolean,
                                                                     enabled As Boolean,
                                                                     Optional allowPointerTextEntry As Boolean = False) As Boolean
            If Not visible OrElse Not enabled Then Return False
            If contract Is Nothing Then Throw New ArgumentNullException(NameOf(contract))

            contract.AssertConsumable()

            ' Do not use pointer-focus suppression as a visual-ring workaround.
            ' Pointer focus is required by composite controls for capture, keyboard
            ' continuation after click, and stable inner hover/pressed feedback.
            ' The optional text-entry flag is intentionally retained for callers
            ' that document text-input behavior, but all composite controls route
            ' through the same official FocusResolver decision.
            Return MASFocusResolver.CanReceivePointerFocus(contract)
        End Function

        Friend Shared Function AllowsOuterFocusRingForCompositeContent(contract As MASResolvedComponentContract,
                                                                       visible As Boolean,
                                                                       enabled As Boolean,
                                                                       hasKeyboardFocus As Boolean) As Boolean
            If Not visible OrElse Not enabled OrElse Not hasKeyboardFocus Then Return False
            If contract Is Nothing Then Throw New ArgumentNullException(NameOf(contract))

            contract.AssertConsumable()

            Return False
        End Function
    End Class

End Namespace
