package com.gcsc.connection.monitoring.dto;

import com.gcsc.connection.service.entity.SnpService;

import java.time.LocalDateTime;

public record HeartbeatStatusResponse(
    Long serviceId,
    String serviceCode,
    String serviceName,
    String healthStatus,
    LocalDateTime healthCheckedAt,
    Integer healthResponseTime
) {

    public static HeartbeatStatusResponse from(SnpService s) {
        return new HeartbeatStatusResponse(
            s.getServiceId(),
            s.getServiceCode(),
            s.getServiceName(),
            s.getHealthStatus().name(),
            s.getHealthCheckedAt(),
            s.getHealthResponseTime()
        );
    }
}
