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

import com.xunhong.erp.turbo.api.biz.dto.qry.GiftBoxListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.GiftBoxVO;
import com.xunhong.erp.turbo.biz.app.assembler.GiftBoxAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.GiftBox;
import com.xunhong.erp.turbo.biz.domain.gateway.GiftBoxGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

	private final GiftBoxGateway giftBoxGateway;
	private final GiftBoxAssembler giftBoxAssembler;

	public List<GiftBoxVO> execute(GiftBoxListQry giftBoxListQry) {
		List<GiftBox> giftBoxList = giftBoxGateway.list(giftBoxListQry);
		return giftBoxList.stream().map(giftBoxAssembler::toGiftBoxVO).toList();
	}
}

