@using Moonlight.Core.Configuration
@using Moonlight.Features.Servers.Entities
@using MoonCore.Services
@using Moonlight.Core.Services
@using Moonlight.Features.FileManager.Models.Abstractions.FileAccess
@using Moonlight.Features.FileManager.UI.Components
@using Moonlight.Features.Servers.Helpers
@using Moonlight.Features.Servers.Services

@inject ServerService ServerService

@implements IDisposable

<LazyLoader Load="Load" ShowAsCard="true">
    <FileManager FileAccess="FileAccess" />
</LazyLoader>

@code
{
    [CascadingParameter] public Server Server { get; set; }

    private BaseFileAccess FileAccess;

    private async Task Load(LazyLoader lazyLoader)
    {
        FileAccess = await ServerService.OpenFileAccess(Server);
    }

    public void Dispose()
    {
        FileAccess.Dispose();
    }
}