Option Strict On
Option Explicit On

Imports System.Collections.Generic
Imports Nexamas.UI.Components
Imports Nexamas.UI.FloatRuntime

Namespace Nexamas.UI.Application

    ''' <summary>
    ''' Public SDK result payload for an accepted application file explorer surface.
    ''' </summary>
    Public NotInheritable Class MASApplicationFileExplorerResult

        Friend Sub New(selectedItem As MASFileExplorerItem,
                       selectedItems As IReadOnlyList(Of MASFileExplorerItem),
                       currentFolder As MASFileExplorerItem,
                       currentPath As String,
                       currentDisplayPath As String)

            Me.SelectedItem = selectedItem
            Me.SelectedItems = If(selectedItems, New List(Of MASFileExplorerItem)())
            Me.CurrentFolder = currentFolder
            Me.CurrentPath = If(currentPath, String.Empty)
            Me.CurrentDisplayPath = If(currentDisplayPath, String.Empty)
        End Sub

        Public ReadOnly Property SelectedItem As MASFileExplorerItem

        Public ReadOnly Property SelectedItems As IReadOnlyList(Of MASFileExplorerItem)

        Public ReadOnly Property CurrentFolder As MASFileExplorerItem

        Public ReadOnly Property CurrentPath As String

        Public ReadOnly Property CurrentDisplayPath As String

        Friend Shared Function FromFloatResult(result As MASFileExplorerFloatResult) As MASApplicationFileExplorerResult
            If result Is Nothing Then
                Return New MASApplicationFileExplorerResult(
                    selectedItem:=Nothing,
                    selectedItems:=New List(Of MASFileExplorerItem)(),
                    currentFolder:=Nothing,
                    currentPath:=String.Empty,
                    currentDisplayPath:=String.Empty)
            End If

            Return New MASApplicationFileExplorerResult(
                selectedItem:=result.SelectedItem,
                selectedItems:=result.SelectedItems,
                currentFolder:=result.CurrentFolder,
                currentPath:=result.CurrentPath,
                currentDisplayPath:=result.CurrentDisplayPath)
        End Function

    End Class

End Namespace
