using System;
using System.Collections.Generic;

namespace StellaOps.Authority.Signing;

internal sealed class AuthoritySigningKeyRequest
{
    public AuthoritySigningKeyRequest(
        string keyId,
        string algorithm,
        string source,
        string location,
        string status,
        string basePath,
        string? provider = null,
        DateTimeOffset? createdAt = null,
        DateTimeOffset? expiresAt = null,
        IReadOnlyDictionary<string, string?>? additionalMetadata = null)
    {
        KeyId = keyId ?? throw new ArgumentNullException(nameof(keyId));
        Algorithm = string.IsNullOrWhiteSpace(algorithm)
            ? throw new ArgumentException("Algorithm identifier is required.", nameof(algorithm))
            : algorithm;
        Source = string.IsNullOrWhiteSpace(source)
            ? throw new ArgumentException("Signing key source is required.", nameof(source))
            : source;
        Location = location ?? throw new ArgumentNullException(nameof(location));
        Status = string.IsNullOrWhiteSpace(status)
            ? throw new ArgumentException("Signing key status is required.", nameof(status))
            : status;
        BasePath = basePath ?? throw new ArgumentNullException(nameof(basePath));
        Provider = provider;
        CreatedAt = createdAt;
        ExpiresAt = expiresAt;
        AdditionalMetadata = additionalMetadata;
    }

    public string KeyId { get; }

    public string Algorithm { get; }

    public string Source { get; }

    public string Location { get; }

    public string Status { get; }

    public string BasePath { get; }

    public string? Provider { get; }

    public DateTimeOffset? CreatedAt { get; }

    public DateTimeOffset? ExpiresAt { get; }

    public IReadOnlyDictionary<string, string?>? AdditionalMetadata { get; }
}
