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

import com.xunhong.erp.turbo.api.user.api.EmployeeServiceI;
import com.xunhong.erp.turbo.api.user.dto.cmd.*;
import com.xunhong.erp.turbo.api.user.dto.qry.EmployeeListQry;
import com.xunhong.erp.turbo.api.user.dto.qry.EmployeePageQry;
import com.xunhong.erp.turbo.api.user.dto.qry.EmployeeShowQry;
import com.xunhong.erp.turbo.api.user.dto.vo.EmployeeVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.user.app.executor.cmd.*;
import com.xunhong.erp.turbo.user.app.executor.query.EmployeeListQryExe;
import com.xunhong.erp.turbo.user.app.executor.query.EmployeePageQryExe;
import com.xunhong.erp.turbo.user.app.executor.query.EmployeeShowQryExe;
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 = EmployeeServiceI.class, version = "1.0.0")
@RequiredArgsConstructor
public class EmployeeServiceImpl implements EmployeeServiceI {

	private final EmployeeCreateCmdExe employeeCreateCmdExe;
	private final EmployeeUpdateCmdExe employeeUpdateCmdExe;
	private final EmployeePageQryExe employeePageQryExe;
	private final EmployeeListQryExe employeeListQryExe;
	private final EmployeeShowQryExe employeeShowQryExe;
	private final EmployeeDestroyCmdExe employeeDestroyCmdExe;
	private final EmployeeRestPasswordCmdExe employeeRestPasswordCmdExe;
	private final EmployeeDisableCmdExe employeeDisableCmdExe;
	private final EmployeeUpdateAvatarCmdExe employeeUpdateAvatarCmdExe;

	@Override
	public EmployeeVO create(EmployeeCreateCmd employeeCreateCmd) {
		return employeeCreateCmdExe.execute(employeeCreateCmd);
	}

	@Override
	public PageDTO<EmployeeVO> page(EmployeePageQry employeePageQry) {
		return PageDTO.of(employeePageQryExe.execute(employeePageQry));
	}

	@Override
	public List<EmployeeVO> list(EmployeeListQry employeeListQry) {
		return employeeListQryExe.execute(employeeListQry);
	}

	@Override
	public EmployeeVO update(EmployeeUpdateCmd employeeUpdateCmd) {
		return employeeUpdateCmdExe.execute(employeeUpdateCmd);
	}

	@Override
	public EmployeeVO show(EmployeeShowQry employeeShowQry) {
		return employeeShowQryExe.execute(employeeShowQry);
	}

	@Override
	public void destroy(EmployeeDestroyCmd employeeDestroyCmd) {
		employeeDestroyCmdExe.execute(employeeDestroyCmd);
	}

	@Override
	public void restPassword(EmployeeRestPasswordCmd employeeRestPasswordCmd) {
		employeeRestPasswordCmdExe.execute(employeeRestPasswordCmd);
	}

	@Override
	public EmployeeVO disable(EmployeeDisableCmd employeeDisableCmd) {
		return employeeDisableCmdExe.execute(employeeDisableCmd);
	}

	@Override
	public void updateAvatar(EmployeeUpdateAvatarCmd employeeUpdateAvatarCmd) {
		employeeUpdateAvatarCmdExe.execute(employeeUpdateAvatarCmd);
	}
}
