package com.aegis.resource.requisition.assembler;

import com.aegis.resource.requisition.domain.RequisitionAgreement;
import com.aegis.resource.requisition.dto.RequisitionAgreementDTO;

/**
 * 征用协议对象转换器（Assembler）
 * 负责 DTO 和领域对象之间的转换（基础设施层职责）
 *
 * @author aegis
 */
public class RequisitionAgreementAssembler {

    /**
     * 将 DTO 转换为领域对象
     */
    public static RequisitionAgreement toDomain(RequisitionAgreementDTO dto) {
        RequisitionAgreement agreement = new RequisitionAgreement();
        agreement.setId(dto.getId());
        agreement.setRequisitionId(dto.getRequisitionId());
        agreement.setServiceScope(dto.getServiceScope());
        agreement.setBillingType(dto.getBillingType());
        agreement.setUnitPrice(dto.getUnitPrice());
        agreement.setCurrency(dto.getCurrency());
        agreement.setEffectiveFrom(dto.getEffectiveFrom());
        agreement.setEffectiveTo(dto.getEffectiveTo());
        agreement.setTerms(dto.getTerms());
        agreement.setAttachmentUrl(dto.getAttachmentUrl());
        agreement.setRemark(dto.getRemark());
        return agreement;
    }

    /**
     * 将领域对象转换为 DTO
     */
    public static RequisitionAgreementDTO toDTO(RequisitionAgreement agreement) {
        RequisitionAgreementDTO dto = new RequisitionAgreementDTO();
        dto.setId(agreement.getId());
        dto.setRequisitionId(agreement.getRequisitionId());
        dto.setServiceScope(agreement.getServiceScope());
        dto.setBillingType(agreement.getBillingType());
        dto.setUnitPrice(agreement.getUnitPrice());
        dto.setCurrency(agreement.getCurrency());
        dto.setEffectiveFrom(agreement.getEffectiveFrom());
        dto.setEffectiveTo(agreement.getEffectiveTo());
        dto.setTerms(agreement.getTerms());
        dto.setAttachmentUrl(agreement.getAttachmentUrl());
        dto.setRemark(agreement.getRemark());
        return dto;
    }
}

