package com.erp.order.dto.response;

import com.erp.order.entity.OrderItem;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;

@Data
@Builder
public class OrderItemResponse {

    private Long id;
    private Long orderId;
    private String goodsName;
    private String platformSku;
    private String skuCode;
    private Long erpSkuId;
    private Integer quantity;
    private BigDecimal price;
    private BigDecimal totalAmount;

    public static OrderItemResponse fromEntity(OrderItem item) {
        return OrderItemResponse.builder()
                .id(item.getId())
                .orderId(item.getOrderId())
                .goodsName(item.getGoodsName())
                .platformSku(item.getPlatformSku())
                .skuCode(item.getSkuCode())
                .erpSkuId(item.getErpSkuId())
                .quantity(item.getQuantity())
                .price(item.getPrice())
                .totalAmount(item.getTotalAmount())
                .build();
    }
}
