package com.aegis.resource.requisition.assembler;

import com.aegis.resource.requisition.domain.RequisitionCompensation;
import com.aegis.resource.requisition.dto.RequisitionCompensationDTO;

/**
 * 补偿记录对象转换器（Assembler）
 * 负责 DTO 和领域对象之间的转换（基础设施层职责）
 *
 * @author aegis
 */
public class RequisitionCompensationAssembler {

    /**
     * 将 DTO 转换为领域对象
     */
    public static RequisitionCompensation toDomain(RequisitionCompensationDTO dto) {
        RequisitionCompensation compensation = new RequisitionCompensation();
        compensation.setId(dto.getId());
        compensation.setRequisitionId(dto.getRequisitionId());
        compensation.setWorkload(dto.getWorkload());
        compensation.setWorkloadUnit(dto.getWorkloadUnit());
        compensation.setUnitPrice(dto.getUnitPrice());
        compensation.setAmount(dto.getAmount());
        compensation.setCurrency(dto.getCurrency());
        compensation.setInvoiceNo(dto.getInvoiceNo());
        compensation.setPaidAt(dto.getPaidAt());
        compensation.setStatus(dto.getStatus());
        compensation.setRemark(dto.getRemark());
        return compensation;
    }

    /**
     * 将领域对象转换为 DTO
     */
    public static RequisitionCompensationDTO toDTO(RequisitionCompensation compensation) {
        RequisitionCompensationDTO dto = new RequisitionCompensationDTO();
        dto.setId(compensation.getId());
        dto.setRequisitionId(compensation.getRequisitionId());
        dto.setWorkload(compensation.getWorkload());
        dto.setWorkloadUnit(compensation.getWorkloadUnit());
        dto.setUnitPrice(compensation.getUnitPrice());
        dto.setAmount(compensation.getAmount());
        dto.setCurrency(compensation.getCurrency());
        dto.setInvoiceNo(compensation.getInvoiceNo());
        dto.setPaidAt(compensation.getPaidAt());
        dto.setStatus(compensation.getStatus());
        dto.setRemark(compensation.getRemark());
        return dto;
    }
}

