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.framework.dto.ResultResponse;
import com.red.circle.other.inner.endpoint.sys.SysCountryCodeClient;
import com.red.circle.other.inner.model.cmd.sys.SysCountryCodeCmd;
import com.red.circle.other.inner.model.cmd.sys.SysCountryCodePageQryCmd;
import com.red.circle.other.inner.model.dto.sys.SysCountryCodeDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类.
 * </p>
 *
 * @author houyong
 * @since 2020-08-11
 */
@Service
@RequiredArgsConstructor
public class SysCountryCodeServiceImpl implements SysCountryCodeService {

  private final SysCountryCodeClient countryCodeClient;

  @Override
  public List<SysCountryCodeDTO> listContent() {
    return ResponseAssert.requiredSuccess(countryCodeClient.listContent());
  }

  @Override
  public PageResult<SysCountryCodeDTO> sysCountryCodePage(SysCountryCodePageQryCmd query) {
    return ResponseAssert.requiredSuccess(countryCodeClient.sysCountryCodePage(query));
  }

  @Override
  public void updateCountryCode(SysCountryCodeCmd cmd) {
    countryCodeClient.updateCountryCode(cmd);
  }

  @Override
  public ResultResponse<SysCountryCodeDTO> getSysCountryCodeById(Long id) {
    return countryCodeClient.getById(id);
  }
}
