Option Strict On
Option Explicit On

Namespace Nexamas.UI.Rendering

    Friend NotInheritable Class MASSurfaceTreatmentRuntimeSurfaceVisualApplicationEntry
        Friend ReadOnly Property ConsumerKind As MASSurfaceTreatmentConsumerKind
        Friend ReadOnly Property ConsumerName As String
        Friend ReadOnly Property Status As MASSurfaceTreatmentRuntimeSurfaceVisualApplicationStatus
        Friend ReadOnly Property DefaultMaterialKey As String
        Friend ReadOnly Property ExampleMaterialKey As String
        Friend ReadOnly Property ResolvedExampleMaterialKey As String
        Friend ReadOnly Property PreservesDefaultVisualWithAuto As Boolean
        Friend ReadOnly Property UsesOfficialResolver As Boolean
        Friend ReadOnly Property UsesOfficialMaterialRegistry As Boolean
        Friend ReadOnly Property IsPublicSurfaceGateway As Boolean
        Friend ReadOnly Property ExcludesInteractiveControls As Boolean
        Friend ReadOnly Property Notes As String

        Friend Sub New(consumerKind As MASSurfaceTreatmentConsumerKind,
                       consumerName As String,
                       status As MASSurfaceTreatmentRuntimeSurfaceVisualApplicationStatus,
                       defaultMaterialKey As String,
                       exampleMaterialKey As String,
                       resolvedExampleMaterialKey As String,
                       preservesDefaultVisualWithAuto As Boolean,
                       usesOfficialResolver As Boolean,
                       usesOfficialMaterialRegistry As Boolean,
                       isPublicSurfaceGateway As Boolean,
                       excludesInteractiveControls As Boolean,
                       notes As String)
            Me.ConsumerKind = consumerKind
            Me.ConsumerName = Normalize(consumerName, consumerKind.ToString())
            Me.Status = status
            Me.DefaultMaterialKey = Normalize(defaultMaterialKey, MASSurfaceMaterialIds.Auto)
            Me.ExampleMaterialKey = Normalize(exampleMaterialKey, "crystal")
            Me.ResolvedExampleMaterialKey = Normalize(resolvedExampleMaterialKey, MASSurfaceMaterialIds.CrystalIce)
            Me.PreservesDefaultVisualWithAuto = preservesDefaultVisualWithAuto
            Me.UsesOfficialResolver = usesOfficialResolver
            Me.UsesOfficialMaterialRegistry = usesOfficialMaterialRegistry
            Me.IsPublicSurfaceGateway = isPublicSurfaceGateway
            Me.ExcludesInteractiveControls = excludesInteractiveControls
            Me.Notes = Normalize(notes, String.Empty)
        End Sub

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Status = MASSurfaceTreatmentRuntimeSurfaceVisualApplicationStatus.ReadyForSurfaceVisualMaterialSelection AndAlso
                       PreservesDefaultVisualWithAuto AndAlso
                       UsesOfficialResolver AndAlso
                       UsesOfficialMaterialRegistry AndAlso
                       ExcludesInteractiveControls
            End Get
        End Property

        Private Shared Function Normalize(value As String, fallback As String) As String
            Dim result As String = If(value, String.Empty).Trim()
            If result.Length = 0 Then Return fallback
            Return result
        End Function
    End Class

End Namespace
