package com.aegis.resource.procurement.assembler;

import com.aegis.resource.procurement.domain.ProcurementQuote;
import com.aegis.resource.procurement.dto.ProcurementQuoteDTO;

/**
 * 供应商报价对象转换器（Assembler）
 * 负责 DTO 和领域对象之间的转换（基础设施层职责）
 *
 * @author aegis
 */
public class ProcurementQuoteAssembler {

    /**
     * 将 DTO 转换为领域对象
     */
    public static ProcurementQuote toDomain(ProcurementQuoteDTO dto) {
        ProcurementQuote quote = new ProcurementQuote();
        quote.setId(dto.getId());
        quote.setProcurementId(dto.getProcurementId());
        quote.setSupplierId(dto.getSupplierId());
        quote.setTotalPrice(dto.getTotalPrice());
        quote.setEta(dto.getEta());
        quote.setNote(dto.getNote());
        quote.setIsAwarded(dto.getIsAwarded());
        return quote;
    }

    /**
     * 将领域对象转换为 DTO
     */
    public static ProcurementQuoteDTO toDTO(ProcurementQuote quote) {
        ProcurementQuoteDTO dto = new ProcurementQuoteDTO();
        dto.setId(quote.getId());
        dto.setProcurementId(quote.getProcurementId());
        dto.setSupplierId(quote.getSupplierId());
        dto.setTotalPrice(quote.getTotalPrice());
        dto.setEta(quote.getEta());
        dto.setNote(quote.getNote());
        dto.setIsAwarded(quote.getIsAwarded());
        dto.setCreateTime(quote.getCreateTime());
        dto.setSupplierName(quote.getSupplierName());
        return dto;
    }
}