namespace NexusShell.Models;

/// <summary>
/// Foundation models for Nexus Control Center — local POC, no portal UI yet.
/// </summary>
public sealed class NexusControlCenterOrganization
{
    public required string Id { get; init; }
    public required string Name { get; init; }
    public int UserCount { get; init; }
    public int DeviceCount { get; init; }
}

public sealed class NexusControlCenterUser
{
    public required string Id { get; init; }
    public required string DisplayName { get; init; }
    public required string OrganizationId { get; init; }
    public string Role { get; init; } = "User";
}

public sealed class NexusControlCenterDevice
{
    public required string DeviceId { get; init; }
    public required string FriendlyName { get; init; }
    public required string Owner { get; init; }
    public required string Organization { get; init; }
    public NexusTrustStatus TrustStatus { get; init; }
    public NexusDeviceEnrollmentStatus EnrollmentStatus { get; init; }
    public DateTimeOffset? LastSeen { get; init; }
}

public sealed class NexusControlCenterDeviceHealth
{
    public required string DeviceId { get; init; }
    public required string Overall { get; init; }
    public int HealthPercent { get; init; }
    public DateTimeOffset CapturedAtUtc { get; init; }
}

public sealed class NexusControlCenterDeviceInventory
{
    public required string DeviceId { get; init; }
    public required string Cpu { get; init; }
    public required string Ram { get; init; }
    public required string Storage { get; init; }
    public required string Gpu { get; init; }
    public int DisplayCount { get; init; }
    public int PrinterCount { get; init; }
    public int UsbDeviceCount { get; init; }
}

public sealed class NexusControlCenterPolicy
{
    public required string Id { get; init; }
    public required string Name { get; init; }
    public string Scope { get; init; } = "device";
    public bool IsEnabled { get; init; }
    public string Summary { get; init; } = string.Empty;
}

public sealed class NexusControlCenterSnapshot
{
    public NexusControlCenterOrganization? Organization { get; init; }
    public NexusControlCenterUser? CurrentUser { get; init; }
    public NexusControlCenterDevice? CurrentDevice { get; init; }
    public NexusControlCenterDeviceHealth? Health { get; init; }
    public NexusControlCenterDeviceInventory? Inventory { get; init; }
    public IReadOnlyList<NexusControlCenterPolicy> Policies { get; init; } = [];
    public NexusControlCenterRemoteDashboard? RemoteDashboard { get; init; }
}

public sealed class NexusControlCenterRemoteDashboard
{
    public DateTime GeneratedAtUtc { get; init; }
    public int OrganizationCount { get; init; }
    public int DeviceCount { get; init; }
    public int PendingEnrollmentCount { get; init; }
    public NexusControlCenterTrustSummary? TrustSummary { get; init; }
    public IReadOnlyList<NexusControlCenterOrganization> Organizations { get; init; } = [];
    public IReadOnlyList<NexusControlCenterPolicy> Policies { get; init; } = [];
    public string Source { get; init; } = "remote";
}

public sealed class NexusControlCenterTrustSummary
{
    public int Trusted { get; init; }
    public int Pending { get; init; }
    public int Blocked { get; init; }
    public int Unknown { get; init; }
}
