Option Strict On
Option Explicit On

Namespace Nexamas.UI.ThemeStudio

    ''' <summary>
    ''' Immutable contrast-check result generated for one theme token pair.
    ''' </summary>
    ''' <remarks>
    ''' Phase 5 records deterministic WCAG-style ratio facts for Theme Studio preview
    ''' safety. It does not mutate themes and does not approve a design by hiding failures.
    ''' </remarks>
    Friend NotInheritable Class MASThemeStudioContrastCheck

        Friend Sub New(themeId As String,
                       name As String,
                       foregroundHex As String,
                       backgroundHex As String,
                       ratio As Double,
                       minimumRatio As Double,
                       passes As Boolean)
            Me.ThemeId = Normalize(themeId)
            Me.Name = Normalize(name)
            Me.ForegroundHex = Normalize(foregroundHex)
            Me.BackgroundHex = Normalize(backgroundHex)
            Me.Ratio = Math.Round(Math.Max(0.0R, ratio), 3)
            Me.MinimumRatio = Math.Round(Math.Max(0.0R, minimumRatio), 3)
            Me.Passes = passes
        End Sub

        Friend ReadOnly Property ThemeId As String
        Friend ReadOnly Property Name As String
        Friend ReadOnly Property ForegroundHex As String
        Friend ReadOnly Property BackgroundHex As String
        Friend ReadOnly Property Ratio As Double
        Friend ReadOnly Property MinimumRatio As Double
        Friend ReadOnly Property Passes As Boolean

        Private Shared Function Normalize(value As String) As String
            Return If(value, String.Empty).Trim()
        End Function

    End Class

End Namespace
