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.EnumConfigClient;
import com.red.circle.other.inner.enums.config.EnumConfigKey;
import com.red.circle.other.inner.model.cmd.sys.SysEnumConfigQryCmd;
import com.red.circle.other.inner.model.dto.sys.EnumConfigDTO;
import com.red.circle.other.inner.model.dto.sys.SysEnumConfigSortDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 系统枚举配置
 *
 * @author zongpubin on 2023/11/1
 */
@Service
@RequiredArgsConstructor
public class SysEnumConfigServiceImpl implements SysEnumConfigService {

  private final EnumConfigClient enumConfigClient;

  @Override
  public PageResult<EnumConfigDTO> pageSysEnumConfig(SysEnumConfigQryCmd query) {
    return ResponseAssert.requiredSuccess(enumConfigClient.pageSysEnumConfig(query));
  }

  @Override
  public List<EnumConfigDTO> sysEnumConfigList(String groupName) {
    return ResponseAssert.requiredSuccess(enumConfigClient.sysEnumConfigList(groupName));
  }

  @Override
  public String getViolationAvatar(EnumConfigKey violationPicture) {
    return ResponseAssert.requiredSuccess(enumConfigClient.getViolationAvatar(violationPicture));
  }

  @Override
  public void saveSysEnumConfig(EnumConfigDTO sysEnumConfig) {
    ResponseAssert.requiredSuccess(enumConfigClient.saveSysEnumConfig(sysEnumConfig));
  }

  @Override
  public void updateSysEnumConfig(EnumConfigDTO sysEnumConfig) {
    ResponseAssert.requiredSuccess(enumConfigClient.updateSysEnumConfig(sysEnumConfig));
  }

  @Override
  public void deleteBySysOriginAndName(Long id) {
    ResponseAssert.requiredSuccess(enumConfigClient.deleteBySysOriginAndName(id));
  }

  @Override
  public void updateSort(List<SysEnumConfigSortDTO> sysEnumConfigSortParams) {
    ResponseAssert.requiredSuccess(enumConfigClient.updateSort(sysEnumConfigSortParams));
  }
}
