@inject ILogger<ImportServiceAliasVault> Logger
@inject NavigationManager NavigationManager
@inject GlobalNotificationService GlobalNotificationService
@inject IStringLocalizerFactory LocalizerFactory
@using AliasVault.ImportExport.Models
@using AliasVault.ImportExport.Importers
@using Microsoft.Extensions.Localization

<ImportServiceCard
    ServiceName="AliasVault"
    Description="@Localizer["AliasVaultDescription"]"
    LogoUrl="img/logo.svg"
    ProcessFileCallback="ProcessFile">
    <p class="text-gray-700 dark:text-gray-300 mb-4">@Localizer["AliasVaultInstructionsPart1"]</p>
</ImportServiceCard>

@code {
    private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");

    private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)
    {
        var importedCredentials = await Task.Run(() =>
        {
            return AliasVault.ImportExport.CredentialCsvService.ImportCredentialsFromCsv(fileContents);
        });

        return importedCredentials;
    }
}