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

import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.other.inner.endpoint.material.props.RoomThemeStoreClient;
import com.red.circle.other.inner.model.cmd.material.RoomThemePageQryCmd;
import com.red.circle.other.inner.model.dto.material.RoomThemeStoreDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 房间主题.
 *
 * @author pengliang on 2023/11/30
 */
@Service
@RequiredArgsConstructor
public class RoomThemeStoreServiceImpl implements RoomThemeStoreService {

  private final RoomThemeStoreClient roomThemeStoreClient;

  @Override
  public PageResult<RoomThemeStoreDTO> pageOps(RoomThemePageQryCmd qryCmd) {
    return roomThemeStoreClient.pageOps(qryCmd).getBody();
  }

  @Override
  public void updateRoomTheme(RoomThemeStoreDTO dto) {
    ResponseAssert.isTrue(CommonErrorCode.UPDATE_FAILURE,
        roomThemeStoreClient.updateRoomTheme(dto).getBody());
  }

  @Override
  public void addRoomTheme(RoomThemeStoreDTO dto) {
    ResponseAssert.isTrue(CommonErrorCode.UPDATE_FAILURE,
        roomThemeStoreClient.addRoomTheme(dto).getBody());
  }

}
