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.AdministratorClient;
import com.red.circle.other.inner.model.cmd.sys.AddSysAdministratorCmd;
import com.red.circle.other.inner.model.cmd.sys.AppUserDetailsQryCmd;
import com.red.circle.other.inner.model.cmd.sys.SysAdministratorChangeStatusCmd;
import com.red.circle.other.inner.model.dto.sys.SysAdministratorInfoDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p>
 * APP管理员表 服务实现类.
 * </p>
 *
 * @author houyong
 * @since 2021-03-23
 */
@Service
@RequiredArgsConstructor
public class SysAdministratorServiceImpl implements SysAdministratorService {

  private final AdministratorClient administratorClient;

  @Override
  public PageResult<SysAdministratorInfoDTO> pageUserDetails(
      AppUserDetailsQryCmd appUserDetailsQuery) {
    return ResponseAssert.requiredSuccess(administratorClient.pageUserDetails(appUserDetailsQuery));
  }

  @Override
  public void addSysAdministrator(AddSysAdministratorCmd cmd) {
    administratorClient.addSysAdministrator(cmd);
  }

  @Override
  public void changeStatusAdministrator(SysAdministratorChangeStatusCmd param) {
    administratorClient.changeStatusAdministrator(param);
  }

  @Override
  public void deleteSysAdministrator(Long id) {
    administratorClient.deleteSysAdministrator(id);
  }

  @Override
  public void changeRoles(Long id, String roles) {
    administratorClient.changeRoles(id, roles);
  }

}
