using System.Text.Json.Serialization;
using Tiku.Api.OpenApi;

namespace Tiku.Api.Configuration;

internal static class ApiPresentationExtensions
{
    internal static IServiceCollection AddApiPresentation(this IServiceCollection services)
    {
        services.AddControllers()
            .AddJsonOptions(options =>
            {
                options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
            });
        services.AddOpenApi(options =>
        {
            options.AddDocumentTransformer<BearerSecuritySchemeTransformer>();
        });
        services.AddProblemDetails();

        return services;
    }
}
