namespace NexusShell.Models;

/// <summary>
/// Deployment model foundation — design interfaces only; no execution in Package System 1.0.
/// </summary>
public enum NexusPackageDeploymentScope
{
    Local,
    Remote,
    Group,
    Organization,
}

public sealed class NexusPackageDeploymentTarget
{
    public required NexusPackageDeploymentScope Scope { get; init; }
    public string? DeviceId { get; init; }
    public string? GroupId { get; init; }
    public string? OrganizationId { get; init; }
}

public sealed class NexusPackageDeploymentRequest
{
    public required string PackageId { get; init; }
    public required string Version { get; init; }
    public required NexusPackageDeploymentTarget Target { get; init; }
    public bool IsMandatory { get; init; }
}

public sealed class NexusPackageDeploymentResult
{
    public required string DeploymentId { get; init; }
    public bool Accepted { get; init; }
    public string? Message { get; init; }
}

public interface INexusPackageDeploymentCoordinator
{
    Task<NexusPackageDeploymentResult> QueueDeploymentAsync(
        NexusPackageDeploymentRequest request,
        CancellationToken cancellationToken = default);

    Task<IReadOnlyList<NexusPackageDeploymentRequest>> GetPendingDeploymentsAsync(
        NexusPackageDeploymentScope? scope = null,
        CancellationToken cancellationToken = default);
}

public sealed class NexusPackageDeploymentCoordinatorStub : INexusPackageDeploymentCoordinator
{
    public Task<NexusPackageDeploymentResult> QueueDeploymentAsync(
        NexusPackageDeploymentRequest request,
        CancellationToken cancellationToken = default) =>
        Task.FromResult(new NexusPackageDeploymentResult
        {
            DeploymentId = Guid.NewGuid().ToString("N"),
            Accepted = false,
            Message = "Package deployment execution is not available in Package System 1.0.",
        });

    public Task<IReadOnlyList<NexusPackageDeploymentRequest>> GetPendingDeploymentsAsync(
        NexusPackageDeploymentScope? scope = null,
        CancellationToken cancellationToken = default) =>
        Task.FromResult<IReadOnlyList<NexusPackageDeploymentRequest>>([]);
}
