package ai.decompile.ai.model.dto;

import ai.decompile.ai.model.entity.ChatMessage;
import java.time.Instant;
import java.util.UUID;

public record MessageResponse(
    UUID id, UUID sessionId, String role, String content, Integer tokenCount, Instant createdAt) {
  public static MessageResponse from(ChatMessage message) {
    return new MessageResponse(
        message.getId(),
        message.getSession().getId(),
        message.getRole(),
        message.getContent(),
        message.getTokenCount(),
        message.getCreatedAt());
  }
}
