namespace NexusShell.Models;

public enum NexusStoreInstallState
{
    NotInstalled,
    Installed,
    UpdateAvailable,
    Broken,
    Disabled,
    Downloading,
    Installing,
    Updating,
    Removing,
    Failed,
}

public enum NexusStoreNavSection
{
    Home,
    Installed,
    Available,
    Updates,
    Favorites,
    NexusApps,
    SystemApps,
    Downloads,
    History,
}

public sealed class NexusStorePackageItem
{
    public required NexusPackageManifest Manifest { get; init; }
    public NexusPackageState PackageState { get; init; }
    public NexusStoreInstallState InstallState { get; init; }
    public string? InstalledVersion { get; init; }
    public bool IsFavorite { get; init; }
    public string IconPath { get; init; } = string.Empty;
    public string StatusLabel { get; init; } = "Ikke installeret";
    public bool CanInstall { get; init; }
    public bool CanOpen { get; init; }
    public bool CanUpdate { get; init; }
    public bool CanRemove { get; init; }
    public NexusDeploymentPhase DeploymentPhase { get; init; }
    public string InstallActionLabel { get; init; } = "Installer";
}

public sealed class NexusStoreHomeSection
{
    public required string Title { get; init; }
    public required IReadOnlyList<NexusStorePackageItem> Packages { get; init; }
}

public sealed class NexusStoreNavItem
{
    public required NexusStoreNavSection Section { get; init; }
    public required string Label { get; init; }
    public required string IconPath { get; init; }
    public int BadgeCount { get; init; }
    public bool HasBadge => BadgeCount > 0;
}

public sealed class NexusStoreHistoryEntry
{
    public string PackageId { get; set; } = string.Empty;
    public string PackageName { get; set; } = string.Empty;
    public string Action { get; set; } = string.Empty;
    public DateTimeOffset At { get; set; }
}
