namespace JobTrackerApi.Services;

public interface IAiSidecarCachePurger
{
    Task PurgeAsync(CancellationToken cancellationToken);
}

public sealed class AiSidecarCachePurger(IHttpClientFactory clients) : IAiSidecarCachePurger
{
    public async Task PurgeAsync(CancellationToken cancellationToken)
    {
        using var response = await clients.CreateClient("ai-service")
            .DeleteAsync("/maintenance/cache", cancellationToken);
        response.EnsureSuccessStatusCode();
    }
}
