using System.ComponentModel.DataAnnotations;
using FrameProcessor.Domain;

namespace FrameProcessor.Configuration;

/// <summary>
/// Wraps the shared API key from <c>appsettings.json</c>. The configured value is bound
/// from the top-level <c>ApiKey</c> key (which is a plain string in the JSON schema —
/// see SPEC.md §6.1) into <see cref="Value"/>; consumers should call <see cref="ToApiKey"/>
/// to obtain the constant-time-comparing <see cref="ApiKey"/> value type.
/// </summary>
public sealed class ApiKeyOptions
{
    public const string SectionName = "ApiKey";

    [Required(AllowEmptyStrings = false)]
    public string Value { get; set; } = string.Empty;

    public ApiKey ToApiKey() => new(Value);
}
