using FastEndpoints;
using System.Text.Json;

namespace KArtSell.Host.Features.Health;

public class PingRequest { }

public class PingResponse
{
    public string Message { get; set; } = "Pong";
}

public class PingEndpoint : Endpoint<PingRequest, PingResponse>
{
    public override void Configure()
    {
        Get("/health/ping");
        Roles("Admin", "Analyst", "System");  // Health checks require authentication
    }

    public override async Task HandleAsync(PingRequest req, CancellationToken ct)
    {
        HttpContext.Response.ContentType = "application/json";
        var response = new PingResponse { Message = "Pong" };
        await HttpContext.Response.WriteAsJsonAsync(response, ct);
    }
}
