Option Strict On
Option Explicit On

Imports System
Imports Nexamas.UI.Components
Imports Nexamas.UI.Scroll.Theming
Imports Nexamas.UI.TopBar.Theming

Namespace Nexamas.UI.Theming

    ''' <summary>
    ''' Base implementation for immutable application themes.
    ''' Provides validated composition of identity, foundation, and family theme layers.
    ''' </summary>
    ''' <remarks>
    ''' Concrete theme classes should only compose factories and must not introduce
    ''' rendering, layout, input, or runtime behavior.
    ''' </remarks>
    <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Advanced)>
    Public MustInherit Class MASAppThemeBase
        Implements IMASAppTheme
        Implements IMASThemeFoundation
        Implements IMASThemeFamilies

#Region "Identity"

        Private ReadOnly _id As String
        Private ReadOnly _displayName As String
        Private ReadOnly _version As Integer

#End Region

#Region "Foundation"

        Private ReadOnly _foundation As IMASThemeFoundation

#End Region

#Region "Families"

        Private ReadOnly _families As IMASThemeFamilies

#End Region

        Friend Sub New(id As String,
                          displayName As String,
                          version As Integer,
                          foundation As IMASThemeFoundation,
                          families As IMASThemeFamilies)

            ThemeValidator.ValidateComposition(
                id:=id,
                displayName:=displayName,
                version:=version,
                foundation:=foundation,
                families:=families)

            _id = id.Trim()
            _displayName = displayName.Trim()
            _version = version
            _foundation = foundation
            _families = families
        End Sub

        Public ReadOnly Property Id As String Implements IMASAppTheme.Id
            Get
                Return _id
            End Get
        End Property

        Public ReadOnly Property DisplayName As String Implements IMASAppTheme.DisplayName
            Get
                Return _displayName
            End Get
        End Property

        Public ReadOnly Property Version As Integer Implements IMASAppTheme.Version
            Get
                Return _version
            End Get
        End Property

        Friend ReadOnly Property Background As IMASBackgroundTheme Implements IMASThemeFoundation.Background
            Get
                Return _foundation.Background
            End Get
        End Property

        Friend ReadOnly Property Brand As IMASBrandTheme Implements IMASThemeFoundation.Brand
            Get
                Return _foundation.Brand
            End Get
        End Property

        Friend ReadOnly Property Neutrals As IMASNeutralTheme Implements IMASThemeFoundation.Neutrals
            Get
                Return _foundation.Neutrals
            End Get
        End Property

        Friend ReadOnly Property Semantics As IMASSemanticTheme Implements IMASThemeFoundation.Semantics
            Get
                Return _foundation.Semantics
            End Get
        End Property

        Friend ReadOnly Property TextColors As IMASTextColorTheme Implements IMASThemeFoundation.TextColors
            Get
                Return _foundation.TextColors
            End Get
        End Property

        Friend ReadOnly Property Interaction As IMASInteractionTheme Implements IMASThemeFoundation.Interaction
            Get
                Return _foundation.Interaction
            End Get
        End Property

        Friend ReadOnly Property TalNeutralInteraction As IMASInteractionTheme Implements IMASThemeFoundation.TalNeutralInteraction
            Get
                Return _foundation.TalNeutralInteraction
            End Get
        End Property

        Friend ReadOnly Property TalPrimaryInteraction As IMASInteractionTheme Implements IMASThemeFoundation.TalPrimaryInteraction
            Get
                Return _foundation.TalPrimaryInteraction
            End Get
        End Property

        Friend ReadOnly Property Surface As IMASFoundationSurfaceTheme Implements IMASThemeFoundation.Surface
            Get
                Return _foundation.Surface
            End Get
        End Property

        Friend ReadOnly Property TalNeutralSurface As MASButtonSurfaceTheme Implements IMASThemeFoundation.TalNeutralSurface
            Get
                Return _foundation.TalNeutralSurface
            End Get
        End Property

        Friend ReadOnly Property TalPrimarySurface As MASButtonSurfaceTheme Implements IMASThemeFoundation.TalPrimarySurface
            Get
                Return _foundation.TalPrimarySurface
            End Get
        End Property

        Friend ReadOnly Property MasNeutralSurface As MASButtonSurfaceTheme Implements IMASThemeFoundation.MasNeutralSurface
            Get
                Return _foundation.MasNeutralSurface
            End Get
        End Property

        Friend ReadOnly Property MasPrimarySurface As MASButtonSurfaceTheme Implements IMASThemeFoundation.MasPrimarySurface
            Get
                Return _foundation.MasPrimarySurface
            End Get
        End Property

        Friend ReadOnly Property MasSubtleSurface As MASButtonSurfaceTheme Implements IMASThemeFoundation.MasSubtleSurface
            Get
                Return _foundation.MasSubtleSurface
            End Get
        End Property

        Friend ReadOnly Property SelectorItem As IMASSelectorItemTheme Implements IMASThemeFamilies.SelectorItem
            Get
                Return _families.SelectorItem
            End Get
        End Property

        Friend ReadOnly Property List As IMASListTheme Implements IMASThemeFamilies.List
            Get
                Return _families.List
            End Get
        End Property

        Friend ReadOnly Property Input As IMASInputTheme Implements IMASThemeFamilies.Input
            Get
                Return _families.Input
            End Get
        End Property

        Friend ReadOnly Property Tile As IMASTileTheme Implements IMASThemeFamilies.Tile
            Get
                Return _families.Tile
            End Get
        End Property

        Friend ReadOnly Property Buttons As IMASButtonTheme Implements IMASThemeFamilies.Buttons
            Get
                Return _families.Buttons
            End Get
        End Property

        Friend ReadOnly Property Cards As IMASCardsTheme Implements IMASThemeFamilies.Cards
            Get
                Return _families.Cards
            End Get
        End Property

        Friend ReadOnly Property Media As IMASMediaTheme Implements IMASThemeFamilies.Media
            Get
                Return _families.Media
            End Get
        End Property

        Friend ReadOnly Property Menu As IMASMenuTheme Implements IMASThemeFamilies.Menu
            Get
                Return _families.Menu
            End Get
        End Property


        Friend ReadOnly Property Scroll As IMASScrollTheme Implements IMASThemeFamilies.Scroll
            Get
                Return _families.Scroll
            End Get
        End Property

        Friend ReadOnly Property TopBar As IMASTopBarTheme Implements IMASThemeFamilies.TopBar
            Get
                Return _families.TopBar
            End Get
        End Property
        Friend ReadOnly Property Progress As IMASProgressTheme Implements IMASThemeFamilies.Progress
            Get
                Return _families.Progress
            End Get
        End Property

        Friend ReadOnly Property SegmentedControl As IMASSegmentedControlTheme Implements IMASThemeFamilies.SegmentedControl
            Get
                Return _families.SegmentedControl
            End Get
        End Property

        Friend ReadOnly Property Toast As IMASToastTheme Implements IMASThemeFamilies.Toast
            Get
                Return _families.Toast
            End Get
        End Property

        Friend ReadOnly Property Tooltip As IMASTooltipTheme Implements IMASThemeFamilies.Tooltip
            Get
                Return _families.Tooltip
            End Get
        End Property
        Friend ReadOnly Property CheckBox As IMASCheckBoxTheme Implements IMASThemeFamilies.CheckBox
            Get
                Return _families.CheckBox
            End Get
        End Property

        Friend ReadOnly Property RadioButton As IMASRadioButtonTheme Implements IMASThemeFamilies.RadioButton
            Get
                Return _families.RadioButton
            End Get
        End Property

        Friend ReadOnly Property ToggleSwitch As IMASToggleSwitchTheme Implements IMASThemeFamilies.ToggleSwitch
            Get
                Return _families.ToggleSwitch
            End Get
        End Property
        Friend ReadOnly Property Tabs As IMASTabTheme Implements IMASThemeFamilies.Tabs
            Get
                Return _families.Tabs
            End Get
        End Property

        Friend ReadOnly Property PanelShell As IMASPanelShellTheme Implements IMASThemeFamilies.PanelShell
            Get
                Return _families.PanelShell
            End Get
        End Property

        Friend ReadOnly Property FrameSurface As IMASFrameSurfaceTheme Implements IMASThemeFamilies.FrameSurface
            Get
                Return _families.FrameSurface
            End Get
        End Property

        Friend ReadOnly Property SurfaceChrome As IMASSurfaceChromeTheme Implements IMASThemeFamilies.SurfaceChrome
            Get
                Return _families.SurfaceChrome
            End Get
        End Property

        Friend ReadOnly Property ColorPicker As IMASColorPickerTheme Implements IMASThemeFamilies.ColorPicker
            Get
                Return _families.ColorPicker
            End Get
        End Property

        Friend ReadOnly Property GroupBox As IMASGroupBoxTheme Implements IMASThemeFamilies.GroupBox
            Get
                Return _families.GroupBox
            End Get
        End Property
        Public Overrides Function ToString() As String
            Return $"{_displayName} (Id={_id}, Version={_version})"
        End Function

    End Class

End Namespace