package com.xunhong.erp.turbo.biz.app.executor.query;

import com.xunhong.erp.turbo.api.biz.dto.qry.DealerRebateCustomerListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerRebateCustomerVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerRebateCustomerAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerRebateCustomer;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerRebateCustomerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author shenyifei
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerRebateCustomerListQryExe {

	private final DealerRebateCustomerGateway dealerRebateCustomerGateway;
	private final DealerRebateCustomerAssembler dealerRebateCustomerAssembler;

	public List<DealerRebateCustomerVO> execute(DealerRebateCustomerListQry dealerRebateCustomerListQry) {
		List<DealerRebateCustomer> dealerRebateCustomerList = dealerRebateCustomerGateway.list(dealerRebateCustomerListQry);
		return dealerRebateCustomerList.stream().map(dealerRebateCustomerAssembler::toDealerRebateCustomerVO).toList();
	}
}

