package com.gcsc.connection.monitoring.dto;

import com.gcsc.connection.monitoring.entity.SnpServiceHealthLog;

import java.time.LocalDateTime;

public record HealthHistoryResponse(
    Long logId,
    Long serviceId,
    String previousStatus,
    String currentStatus,
    Integer responseTime,
    String errorMessage,
    LocalDateTime checkedAt
) {

    public static HealthHistoryResponse from(SnpServiceHealthLog log) {
        return new HealthHistoryResponse(
            log.getLogId(),
            log.getService().getServiceId(),
            log.getPreviousStatus(),
            log.getCurrentStatus(),
            log.getResponseTime(),
            log.getErrorMessage(),
            log.getCheckedAt()
        );
    }
}
