package com.aegis.resource.supplier.assembler;

import com.aegis.resource.supplier.domain.Supplier;
import com.aegis.resource.supplier.dto.SupplierDTO;

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

    /**
     * 将 DTO 转换为领域对象
     */
    public static Supplier toDomain(SupplierDTO dto) {
        Supplier supplier = new Supplier();
        supplier.setId(dto.getId());
        supplier.setSupplierCode(dto.getSupplierCode());
        supplier.setSupplierName(dto.getSupplierName());
        supplier.setCreditCode(dto.getCreditCode());
        supplier.setCategory(dto.getCategory());
        supplier.setArea(dto.getArea());
        supplier.setContactPerson(dto.getContactPerson());
        supplier.setContactPhone(dto.getContactPhone());
        supplier.setEmail(dto.getEmail());
        supplier.setAddress(dto.getAddress());
        supplier.setStatus(dto.getStatus());
        supplier.setRating(dto.getRating());
        supplier.setRemark(dto.getRemark());
        return supplier;
    }
}