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

import com.xunhong.erp.turbo.api.biz.dto.qry.BoxBrandListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxBrandVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxBrandAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxBrand;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxBrandGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

	private final BoxBrandGateway boxBrandGateway;
	private final BoxBrandAssembler boxBrandAssembler;

	public List<BoxBrandVO> execute(BoxBrandListQry boxBrandListQry) {
		List<BoxBrand> boxBrandList = boxBrandGateway.list(boxBrandListQry);
		return boxBrandList.stream().map(boxBrandAssembler::toBoxBrandVO).toList();
	}
}

