package ai.decompile.workspace.model.dto;

import ai.decompile.workspace.model.entity.Project;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.Instant;
import java.util.UUID;

public record ProjectResponse(
    @NotNull UUID id,
    @NotNull UUID workspaceId,
    @NotBlank String name,
    String description,
    @NotNull Instant updatedAt,
    int binaryCount) {
  public static ProjectResponse from(Project project) {
    return new ProjectResponse(
        project.getId(),
        project.getWorkspace().getId(),
        project.getName(),
        project.getDescription(),
        project.getUpdatedAt(),
        project.getBinaries().size());
  }
}
