package com.red.circle.console.app.service.app.sys;

import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.other.inner.endpoint.sys.VersionClient;
import com.red.circle.other.inner.model.cmd.sys.VersionManageQryCmd;
import com.red.circle.other.inner.model.dto.sys.VersionManageDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhengmigndong
 * @since 2019-05-05
 */
@Service
@RequiredArgsConstructor
public class VersionManageServiceImpl implements VersionManageService {

  private final VersionClient versionClient;

  @Override
  public PageResult<VersionManageDTO> pageVersionManage(VersionManageQryCmd cmd) {
    return ResponseAssert.requiredSuccess(versionClient.pageVersionManage(cmd));
  }

  @Override
  public Boolean saveVersionManage(VersionManageDTO param) {
    return ResponseAssert.requiredSuccess(versionClient.saveVersionManage(param));
  }

  @Override
  public void deleteVersionManage(Long id) {
    ResponseAssert.requiredSuccess(versionClient.deleteVersionManage(id));
  }

  @Override
  public void updateVersionManage(VersionManageDTO param) {
    ResponseAssert.requiredSuccess(versionClient.updateVersionManage(param));
  }

  @Override
  public void addBuildVersion(String sysOrigin, String platform, String channel,
      Integer buildVersion) {
    ResponseAssert.requiredSuccess(
        versionClient.addBuildVersion(sysOrigin, platform, channel, buildVersion));
  }

  @Override
  public Integer getBuildVersion(String sysOrigin, String platform, String channel) {
    return ResponseAssert.requiredSuccess(
        versionClient.getBuildVersion(sysOrigin, platform, channel));
  }
}
