using NexusShell.Models;

namespace NexusShell.Services;

public sealed class NexusPreviewService
{
    public NexusPreviewState BuildPreview(FileSystemItem? item)
    {
        if (item is null)
        {
            return new NexusPreviewState
            {
                Title = "Ingen forhåndsvisning",
                Subtitle = "Vælg en fil for at se detaljer",
                IconPath = NexusLucideIcons.File,
                HasSelection = false,
            };
        }

        if (item.IsDirectory)
        {
            return new NexusPreviewState
            {
                Title = item.Name,
                Subtitle = item.IsDrive ? "Drev" : "Mappe",
                IconPath = item.IsDrive ? NexusLucideIcons.HardDrive : NexusLucideIcons.FolderOpen,
                HasSelection = true,
            };
        }

        return new NexusPreviewState
        {
            Title = item.Name,
            Subtitle = $"{item.KindLabel} · {item.SizeLabel} · {item.ModifiedLabel}",
            IconPath = item.IconPath,
            HasSelection = true,
        };
    }
}
