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

import kr.co.accura.wtm.domain.wbs.entity.WbsVersion;

import java.time.LocalDate;
import java.time.LocalDateTime;

public record WbsVersionDto(
        Long id,
        Long projectId,
        Integer versionNumber,
        LocalDate effectiveDate,
        String sourceType,
        String sourceFilename,
        String description,
        String status,
        Long uploadedBy,
        LocalDateTime createdAt,
        int nodeCount
) {
    public static WbsVersionDto from(WbsVersion version, int nodeCount) {
        return new WbsVersionDto(
                version.getId(),
                version.getProjectId(),
                version.getVersionNumber(),
                version.getEffectiveDate(),
                version.getSourceType(),
                version.getSourceFilename(),
                version.getDescription(),
                version.getStatus(),
                version.getUploadedBy(),
                version.getCreatedAt(),
                nodeCount
        );
    }
}
