using System.Collections.Immutable;
using StellaOps.Excititor.Core;

namespace StellaOps.Excititor.Connectors.Abstractions;

/// <summary>
/// Static descriptor for a Excititor connector plug-in.
/// </summary>
public sealed record VexConnectorDescriptor
{
    public VexConnectorDescriptor(string id, VexProviderKind kind, string displayName)
    {
        if (string.IsNullOrWhiteSpace(id))
        {
            throw new ArgumentException("Connector id must be provided.", nameof(id));
        }

        Id = id;
        Kind = kind;
        DisplayName = string.IsNullOrWhiteSpace(displayName) ? id : displayName;
    }

    /// <summary>
    /// Stable connector identifier (matches provider id).
    /// </summary>
    public string Id { get; }

    /// <summary>
    /// Provider kind served by the connector.
    /// </summary>
    public VexProviderKind Kind { get; }

    /// <summary>
    /// Human friendly name used in logs/diagnostics.
    /// </summary>
    public string DisplayName { get; }

    /// <summary>
    /// Optional friendly description.
    /// </summary>
    public string? Description { get; init; }

    /// <summary>
    /// Document formats the connector is expected to emit.
    /// </summary>
    public ImmutableArray<VexDocumentFormat> SupportedFormats { get; init; } = ImmutableArray<VexDocumentFormat>.Empty;

    /// <summary>
    /// Optional tags surfaced in diagnostics (e.g. "beta", "offline").
    /// </summary>
    public ImmutableArray<string> Tags { get; init; } = ImmutableArray<string>.Empty;

    public override string ToString() => $"{Id} ({Kind})";
}
