using OpenHarbor.CQRS.Abstractions;

namespace Codex.CQRS.Queries;

/// <summary>
/// Health check query to verify API availability
/// </summary>
/// <remarks>
/// This query is automatically exposed as a REST endpoint by OpenHarbor.CQRS framework.
/// Endpoint: POST /api/query/HealthQuery
/// </remarks>
public record HealthQuery
{
}

/// <summary>
/// Handles health check queries
/// </summary>
public class HealthQueryHandler : IQueryHandler<HealthQuery, bool>
{
    /// <summary>
    /// Executes the health check
    /// </summary>
    /// <param name="query">The health query request</param>
    /// <param name="cancellationToken">Cancellation token</param>
    /// <returns>Always returns true to indicate the API is healthy</returns>
    /// <response code="200">API is healthy and operational</response>
    public Task<bool> HandleAsync(HealthQuery query, CancellationToken cancellationToken = default)
      => Task.FromResult(true);
}
