package com.gcsc.connection.service.dto;

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

import java.time.LocalDateTime;

public record ServiceResponse(
    Long serviceId,
    String serviceCode,
    String serviceName,
    String serviceUrl,
    String description,
    String healthCheckUrl,
    Integer healthCheckInterval,
    String healthStatus,
    LocalDateTime healthCheckedAt,
    Integer healthResponseTime,
    Boolean isActive,
    LocalDateTime createdAt,
    LocalDateTime updatedAt
) {

    public static ServiceResponse from(SnpService s) {
        return new ServiceResponse(
            s.getServiceId(),
            s.getServiceCode(),
            s.getServiceName(),
            s.getServiceUrl(),
            s.getDescription(),
            s.getHealthCheckUrl(),
            s.getHealthCheckInterval(),
            s.getHealthStatus().name(),
            s.getHealthCheckedAt(),
            s.getHealthResponseTime(),
            s.getIsActive(),
            s.getCreatedAt(),
            s.getUpdatedAt()
        );
    }
}
