package com.cameleer.server.app.dto;

import com.cameleer.server.core.agent.AgentEventRecord;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

import java.time.Instant;

@Schema(description = "Agent lifecycle event")
public record AgentEventResponse(
        @NotNull long id,
        @NotNull String instanceId,
        @NotNull String applicationId,
        @NotNull String eventType,
        String detail,
        @NotNull Instant timestamp
) {
    public static AgentEventResponse from(AgentEventRecord event) {
        return new AgentEventResponse(
                event.id(), event.instanceId(), event.applicationId(),
                event.eventType(), event.detail(), event.timestamp()
        );
    }
}
