package com.xunhong.erp.turbo.biz.app.service;

import com.xunhong.erp.turbo.api.biz.api.DealerServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerDragCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.biz.app.executor.cmd.DealerCreateCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.cmd.DealerDestroyCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.cmd.DealerUpdateCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.query.DealerDragCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.query.DealerListQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.DealerPageQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.DealerShowQryExe;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shenyifei
 */
@Slf4j
@Service
@DubboService(interfaceClass = DealerServiceI.class, version = "1.0.0")
@RequiredArgsConstructor
public class DealerServiceImpl implements DealerServiceI {

	private final DealerCreateCmdExe dealerCreateCmdExe;
	private final DealerUpdateCmdExe dealerUpdateCmdExe;
	private final DealerShowQryExe dealerShowQryExe;
	private final DealerDestroyCmdExe dealerDestroyCmdExe;
	private final DealerPageQryExe dealerPageQryExe;
	private final DealerListQryExe dealerListQryExe;
	private final DealerDragCmdExe dealerDragCmdExe;

	@Override
	public DealerVO create(DealerCreateCmd dealerCreateCmd) {
		return dealerCreateCmdExe.execute(dealerCreateCmd);
	}

	@Override
	public PageDTO<DealerVO> page(DealerPageQry dealerPageQry) {
		return PageDTO.of(dealerPageQryExe.execute(dealerPageQry));
	}

	@Override
	public List<DealerVO> list(DealerListQry dealerListQry) {
		return dealerListQryExe.execute(dealerListQry);
	}

	@Override
	public DealerVO update(DealerUpdateCmd dealerUpdateCmd) {
		return dealerUpdateCmdExe.execute(dealerUpdateCmd);
	}

	@Override
	public DealerVO show(DealerShowQry dealerShowQry) {
		return dealerShowQryExe.execute(dealerShowQry);
	}

	@Override
	public void destroy(DealerDestroyCmd dealerDestroyCmd) {
		dealerDestroyCmdExe.execute(dealerDestroyCmd);
	}

	@Override
	public void drag(DealerDragCmd dealerDragCmd) {
		dealerDragCmdExe.execute(dealerDragCmd);
	}
}