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

import com.xunhong.erp.turbo.api.infra.api.PlatformServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.PlatformCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.PlatformDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.PlatformUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformListQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformPageQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.PlatformVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.infra.app.executor.cmd.PlatformCreateCmdExe;
import com.xunhong.erp.turbo.infra.app.executor.cmd.PlatformDestroyCmdExe;
import com.xunhong.erp.turbo.infra.app.executor.cmd.PlatformUpdateCmdExe;
import com.xunhong.erp.turbo.infra.app.executor.query.PlatformListQryExe;
import com.xunhong.erp.turbo.infra.app.executor.query.PlatformPageQryExe;
import com.xunhong.erp.turbo.infra.app.executor.query.PlatformShowQryExe;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.List;

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

	private final PlatformCreateCmdExe platformCreateCmdExe;
	private final PlatformUpdateCmdExe platformUpdateCmdExe;
	private final PlatformPageQryExe platformPageQryExe;
	private final PlatformListQryExe platformListQryExe;
	private final PlatformShowQryExe platformShowQryExe;
	private final PlatformDestroyCmdExe platformDestroyCmdExe;

	@Override
	public PlatformVO create(PlatformCreateCmd platformCreateCmd) {
		return platformCreateCmdExe.execute(platformCreateCmd);
	}

	@Override
	public PageDTO<PlatformVO> page(PlatformPageQry platformPageQry) {
		return PageDTO.of(platformPageQryExe.execute(platformPageQry));
	}

	@Override
	public List<PlatformVO> list(PlatformListQry platformListQry) {
		return platformListQryExe.execute(platformListQry);
	}

	@Override
	public PlatformVO update(PlatformUpdateCmd platformUpdateCmd) {
		return platformUpdateCmdExe.execute(platformUpdateCmd);
	}

	@Override
	public PlatformVO show(PlatformShowQry platformShowQry) {
		return platformShowQryExe.execute(platformShowQry);
	}

	@Override
	public void destroy(PlatformDestroyCmd platformDestroyCmd) {
		platformDestroyCmdExe.execute(platformDestroyCmd);
	}
}
