package com.sb.web.account.dto; import com.sb.web.account.domain.AccountEntry; import lombok.Builder; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDate; import java.util.List; /** * 가계부 항목 응답 (소유자 ID 제외, 태그 이름 포함). */ @Data @Builder public class AccountEntryResponse { private Long id; private LocalDate entryDate; private String type; private String category; private Long amount; private String memo; private Long walletId; private String walletName; private Long toWalletId; private String toWalletName; private Integer installmentMonths; private Boolean pending; private String currency; private BigDecimal originalAmount; private BigDecimal exchangeRate; private List tags; public static AccountEntryResponse from(AccountEntry e, List tags) { return AccountEntryResponse.builder() .id(e.getId()) .entryDate(e.getEntryDate()) .type(e.getType()) .category(e.getCategory()) .amount(e.getAmount()) .memo(e.getMemo()) .walletId(e.getWalletId()) .walletName(e.getWalletName()) .toWalletId(e.getToWalletId()) .toWalletName(e.getToWalletName()) .installmentMonths(e.getInstallmentMonths()) .pending(Boolean.TRUE.equals(e.getPending())) .currency(e.getCurrency()) .originalAmount(e.getOriginalAmount()) .exchangeRate(e.getExchangeRate()) .tags(tags) .build(); } }