namespace EntKube.SharedKernel.Contracts;
///
/// Standard API response envelope used by all EntKube microservices.
/// Every HTTP response wraps its payload in this structure so clients
/// always know where to find the data, error messages, and metadata.
///
public record ApiResponse
{
public bool Success { get; init; }
public T? Data { get; init; }
public string? Error { get; init; }
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
public static ApiResponse Ok(T data) => new()
{
Success = true,
Data = data
};
public static ApiResponse Fail(string error) => new()
{
Success = false,
Error = error
};
}