// Package health provides interfaces and types for health checking.
package health

import "context"

// HealthChecker defines the interface for health checks.
type HealthChecker interface {
	// Check performs a health check and returns an error if unhealthy.
	// Returns nil if the component is healthy.
	Check(ctx context.Context) error
}

// Status represents the health status of a component.
type Status string

const (
	// StatusHealthy indicates the component is healthy.
	StatusHealthy Status = "healthy"
	// StatusUnhealthy indicates the component is unhealthy.
	StatusUnhealthy Status = "unhealthy"
)

// ComponentStatus represents the health status of a single component.
type ComponentStatus struct {
	Name   string `json:"name"`
	Status Status `json:"status"`
	Error  string `json:"error,omitempty"`
}

// HealthStatus represents the overall health status.
type HealthStatus struct {
	Status     Status            `json:"status"`
	Components []ComponentStatus `json:"components,omitempty"`
}
