package kr.co.accura.wtm.domain.project.dto;

import kr.co.accura.wtm.domain.project.entity.ProjectAssignment;

import java.time.LocalDateTime;

public record ProjectAssignmentDto(
        Long id,
        Long projectId,
        Long userId,
        String userName,
        String userEmail,
        String role,
        LocalDateTime assignedAt
) {
    public static ProjectAssignmentDto from(ProjectAssignment assignment) {
        return new ProjectAssignmentDto(
                assignment.getId(),
                assignment.getProject().getId(),
                assignment.getUser().getId(),
                assignment.getUser().getFullName(),
                assignment.getUser().getEmail(),
                assignment.getRole(),
                assignment.getAssignedAt()
        );
    }
}
