Option Strict On
Option Explicit On

Imports System
Imports Nexamas.UI.Theming

Namespace Nexamas.UI.Application

    ''' <summary>
    ''' Public SDK context passed to Application-owned layered scene rendering.
    ''' This intentionally avoids exposing the layered runtime host.
    ''' </summary>
    <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Advanced)>
    Friend NotInheritable Class MASApplicationLayeredSceneContext

        Private ReadOnly _themeContext As MASThemeContext
        Private ReadOnly _width As Integer
        Private ReadOnly _height As Integer

        Friend Sub New(themeContext As MASThemeContext,
                       width As Integer,
                       height As Integer)

            If themeContext Is Nothing Then Throw New ArgumentNullException(NameOf(themeContext))

            _themeContext = themeContext
            _width = Math.Max(0, width)
            _height = Math.Max(0, height)

        End Sub

        Friend ReadOnly Property Dpi As Single
            Get
                Return Math.Max(1.0F, _themeContext.Dpi)
            End Get
        End Property

        Friend ReadOnly Property WidthPx As Integer
            Get
                Return _width
            End Get
        End Property

        Friend ReadOnly Property HeightPx As Integer
            Get
                Return _height
            End Get
        End Property

        ''' <summary>
        ''' Advanced bridge for MAS renderers that still consume ThemeContext.
        ''' Do not use this in normal application code.
        ''' </summary>
        Friend ReadOnly Property ThemeContextCore As MASThemeContext
            Get
                Return _themeContext
            End Get
        End Property

    End Class

End Namespace