using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Diagnostics.HealthChecks;

namespace ZB.MOM.WW.Health;

/// <summary>
/// Options for <see cref="ZbHealthEndpointExtensions.MapZbHealth"/>. Lets callers override the
/// three tier route paths and the JSON response writer. The defaults match the ZB.MOM.WW health contract.
/// </summary>
public sealed class ZbHealthEndpointOptions
{
    /// <summary>Path for the readiness tier (runs only checks tagged <see cref="ZbHealthTags.Ready"/>).</summary>
    public string ReadyPath { get; set; } = "/health/ready";

    /// <summary>Path for the active-node tier (runs only checks tagged <see cref="ZbHealthTags.Active"/>).</summary>
    public string ActivePath { get; set; } = "/health/active";

    /// <summary>Path for the bare liveness tier (runs no checks; 200 while the process is up).</summary>
    public string LivePath { get; set; } = "/healthz";

    /// <summary>
    /// Response writer for the readiness and active tiers. Defaults to
    /// <see cref="ZbHealthWriter.WriteJsonAsync"/> (canonical JSON). The liveness tier runs no checks
    /// and emits a minimal body, so this writer is not applied to it.
    /// </summary>
    public Func<HttpContext, HealthReport, Task>? ResponseWriter { get; set; }
}
