using JobTrackerApi.Controllers;
using JobTrackerApi.Services;
using Microsoft.Extensions.Configuration;
using Moq;
using Xunit;

namespace JobTrackerApi.Tests;

public sealed class ProductionConfigTests
{
    [Fact]
    public void Summarizer_service_exposes_section_summarization_api()
    {
        var method = typeof(ISummarizerService).GetMethod("SummarizeSectionAsync");
        Assert.NotNull(method);
    }

    [Fact]
    public void Summarizer_metrics_include_runtime_device_details()
    {
        var ctor = typeof(AiServiceMetrics).GetConstructors().Single();
        var parameterNames = ctor.GetParameters().Select(x => x.Name).ToHashSet(StringComparer.OrdinalIgnoreCase);

        Assert.Contains("device", parameterNames);
        Assert.Contains("gpuAvailable", parameterNames);
        Assert.Contains("gpuName", parameterNames);
    }

    [Fact]
    public void Profile_cv_controller_supports_pdf_and_docx_extensions()
    {
        var field = typeof(ProfileCvController).GetField("AllowedExtensions", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
        Assert.NotNull(field);
        var values = ((System.Collections.IEnumerable)field!.GetValue(null)!).Cast<string>().ToHashSet(StringComparer.OrdinalIgnoreCase);
        Assert.Contains(".pdf", values);
        Assert.Contains(".docx", values);
    }
}
