Option Strict On
Option Explicit On

Imports System
Imports SkiaSharp

Namespace Nexamas.UI.Theming

    ''' <summary>
    ''' Immutable implementation of foundation surface color tokens.
    ''' This is a token container only; it does not render acrylic/effects.
    ''' </summary>
    <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Advanced)>
    Friend NotInheritable Class MASFoundationSurfaceTheme
        Implements IMASFoundationSurfaceTheme

        Private ReadOnly _surfaceTop As SKColor
        Private ReadOnly _surfaceMid As SKColor
        Private ReadOnly _surfaceBot As SKColor
        Private ReadOnly _materialWash As SKColor
        Private ReadOnly _borderOuter As SKColor
        Private ReadOnly _borderInner As SKColor
        Private ReadOnly _shadowBase As SKColor
        Private ReadOnly _backgroundColdTint As SKColor

        Friend Sub New(surfaceTop As SKColor,
                       surfaceMid As SKColor,
                       surfaceBot As SKColor,
                       materialWash As SKColor,
                       borderOuter As SKColor,
                       borderInner As SKColor,
                       shadowBase As SKColor,
                       backgroundColdTint As SKColor)

            ValidateRequiredColor(surfaceTop, NameOf(surfaceTop))
            ValidateRequiredColor(surfaceMid, NameOf(surfaceMid))
            ValidateRequiredColor(surfaceBot, NameOf(surfaceBot))
            ValidateRequiredColor(materialWash, NameOf(materialWash))
            ValidateRequiredColor(borderOuter, NameOf(borderOuter))
            ValidateRequiredColor(borderInner, NameOf(borderInner))
            ValidateRequiredColor(shadowBase, NameOf(shadowBase))
            ValidateRequiredColor(backgroundColdTint, NameOf(backgroundColdTint))

            _surfaceTop = surfaceTop
            _surfaceMid = surfaceMid
            _surfaceBot = surfaceBot
            _materialWash = materialWash
            _borderOuter = borderOuter
            _borderInner = borderInner
            _shadowBase = shadowBase
            _backgroundColdTint = backgroundColdTint
        End Sub

        Public ReadOnly Property SurfaceTop As SKColor Implements IMASFoundationSurfaceTheme.SurfaceTop
            Get
                Return _surfaceTop
            End Get
        End Property

        Public ReadOnly Property SurfaceMid As SKColor Implements IMASFoundationSurfaceTheme.SurfaceMid
            Get
                Return _surfaceMid
            End Get
        End Property

        Public ReadOnly Property SurfaceBot As SKColor Implements IMASFoundationSurfaceTheme.SurfaceBot
            Get
                Return _surfaceBot
            End Get
        End Property

        Public ReadOnly Property MaterialWash As SKColor Implements IMASFoundationSurfaceTheme.MaterialWash
            Get
                Return _materialWash
            End Get
        End Property

        Public ReadOnly Property BorderOuter As SKColor Implements IMASFoundationSurfaceTheme.BorderOuter
            Get
                Return _borderOuter
            End Get
        End Property

        Public ReadOnly Property BorderInner As SKColor Implements IMASFoundationSurfaceTheme.BorderInner
            Get
                Return _borderInner
            End Get
        End Property

        Public ReadOnly Property ShadowBase As SKColor Implements IMASFoundationSurfaceTheme.ShadowBase
            Get
                Return _shadowBase
            End Get
        End Property

        Public ReadOnly Property BackgroundColdTint As SKColor Implements IMASFoundationSurfaceTheme.BackgroundColdTint
            Get
                Return _backgroundColdTint
            End Get
        End Property

        Private Shared Sub ValidateRequiredColor(color As SKColor, paramName As String)
            If color.Alpha = 0 AndAlso color.Red = 0 AndAlso color.Green = 0 AndAlso color.Blue = 0 Then
                Throw New ArgumentException("Color cannot be empty or fully transparent black.", paramName)
            End If
        End Sub

    End Class

End Namespace