package ai.decompile.ai.model.dto;

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

public record SessionResponse(
    UUID id,
    UUID binaryId,
    UUID projectId,
    String title,
    String chatModel,
    int messageCount,
    Instant createdAt,
    Instant updatedAt) {
  public static SessionResponse from(ChatSession session) {
    return new SessionResponse(
        session.getId(),
        session.getBinaryId(),
        session.getProjectId(),
        session.getTitle(),
        session.getChatModel(),
        session.getMessages() != null ? session.getMessages().size() : 0,
        session.getCreatedAt(),
        session.getUpdatedAt());
  }
}
