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

import kr.co.accura.wtm.domain.teal.entity.TealEntry;
import lombok.*;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TealEntryDto {

    private Long id;
    private String wbsCode;
    private Long canonicalWbsId;
    private String activityCode;
    private String activityName;
    private String discipline;
    private Boolean isActive;

    public static TealEntryDto from(TealEntry entry) {
        return TealEntryDto.builder()
                .id(entry.getId())
                .wbsCode(entry.getCanonicalWbs() != null ? entry.getCanonicalWbs().getWbsCode() : null)
                .canonicalWbsId(entry.getCanonicalWbs() != null ? entry.getCanonicalWbs().getId() : null)
                .activityCode(entry.getActivityCode())
                .activityName(entry.getActivityName())
                .discipline(entry.getDiscipline())
                .isActive(entry.getIsActive())
                .build();
    }
}
