Option Strict On
Option Explicit On

Namespace Nexamas.UI.Application

    ''' <summary>
    ''' Internal result object produced by the owned PanelShell command path.
    ''' Public SDK consumers receive dedicated gateway results such as
    ''' MASSelectionPanelResult instead of this low-level command result.
    ''' </summary>
    Friend NotInheritable Class MASApplicationPanelResult

        Friend Property CommandId As String = String.Empty

        Friend Property Cancelled As Boolean = False

        Friend Property UserState As Object

        Friend Sub New()
        End Sub

        Friend Sub New(commandId As String,
                       Optional cancelled As Boolean = False,
                       Optional userState As Object = Nothing)

            Me.CommandId = If(commandId, String.Empty)
            Me.Cancelled = cancelled
            Me.UserState = userState

        End Sub

        Friend Shared Function FromCommand(commandId As String,
                                           Optional userState As Object = Nothing) As MASApplicationPanelResult

            Return New MASApplicationPanelResult(
                commandId:=commandId,
                cancelled:=False,
                userState:=userState)

        End Function

        Friend Shared Function Cancel(Optional userState As Object = Nothing) As MASApplicationPanelResult

            Return New MASApplicationPanelResult(
                commandId:=String.Empty,
                cancelled:=True,
                userState:=userState)

        End Function

    End Class

End Namespace