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

import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.other.inner.endpoint.sys.AdministratorClient;
import com.red.circle.other.inner.model.cmd.sys.SysAdministratorAuthResourceCmd;
import com.red.circle.other.inner.model.dto.sys.SysAdministratorAuthResourceDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 系统管理员 实现.
 *
 * @author pengliang on 2023/8/11
 */
@Service
@RequiredArgsConstructor
public class SysAdministratorAuthResourceServiceImpl implements
    SysAdministratorAuthResourceService {

  private final AdministratorClient administratorClient;

  @Override
  public List<SysAdministratorAuthResourceDTO> getSysAdministratorAuthResource() {
    return ResponseAssert.requiredSuccess(administratorClient.getSysAdministratorAuthResource());
  }


  @Override
  public List<Long> getSysAdministratorAuthResourceByUserId(Long userId) {
    return ResponseAssert.requiredSuccess(
        administratorClient.getSysAdministratorAuthResourceByUserId(userId));
  }

  @Override
  public void updateSysAdministratorAuthResource(
      SysAdministratorAuthResourceCmd cmd) {
    administratorClient.updateSysAdministratorAuthResource((cmd));
  }

  @Override
  public void addSysAdministratorAuthResource(
      SysAdministratorAuthResourceCmd cmd) {
    administratorClient.addSysAdministratorAuthResource((cmd));
  }

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