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

import com.xunhong.erp.turbo.api.infra.api.AgreementServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.AgreementListQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.AgreementPageQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.AgreementShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.AgreementVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.infra.app.executor.cmd.AgreementCreateCmdExe;
import com.xunhong.erp.turbo.infra.app.executor.cmd.AgreementDestroyCmdExe;
import com.xunhong.erp.turbo.infra.app.executor.cmd.AgreementUpdateCmdExe;
import com.xunhong.erp.turbo.infra.app.executor.query.AgreementListQryExe;
import com.xunhong.erp.turbo.infra.app.executor.query.AgreementPageQryExe;
import com.xunhong.erp.turbo.infra.app.executor.query.AgreementShowQryExe;
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 = AgreementServiceI.class, version = "1.0.0")
@RequiredArgsConstructor
public class AgreementServiceImpl implements AgreementServiceI {

	private final AgreementCreateCmdExe agreementCreateCmdExe;
	private final AgreementUpdateCmdExe agreementUpdateCmdExe;
	private final AgreementPageQryExe agreementPageQryExe;
	private final AgreementListQryExe agreementListQryExe;
	private final AgreementShowQryExe agreementShowQryExe;
	private final AgreementDestroyCmdExe agreementDestroyCmdExe;

	@Override
	public AgreementVO create(AgreementCreateCmd agreementCreateCmd) {
		return agreementCreateCmdExe.execute(agreementCreateCmd);
	}

	@Override
	public PageDTO<AgreementVO> page(AgreementPageQry agreementPageQry) {
		return PageDTO.of(agreementPageQryExe.execute(agreementPageQry));
	}

	@Override
	public List<AgreementVO> list(AgreementListQry agreementListQry) {
		return agreementListQryExe.execute(agreementListQry);
	}

	@Override
	public AgreementVO update(AgreementUpdateCmd agreementUpdateCmd) {
		return agreementUpdateCmdExe.execute(agreementUpdateCmd);
	}

	@Override
	public AgreementVO show(AgreementShowQry agreementShowQry) {
		return agreementShowQryExe.execute(agreementShowQry);
	}

	@Override
	public void destroy(AgreementDestroyCmd agreementDestroyCmd) {
		agreementDestroyCmdExe.execute(agreementDestroyCmd);
	}
}

