package com.red.circle.other.app.inner.endpoint.material.props;

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.material.props.RoomBadgeClientService;
import com.red.circle.other.inner.endpoint.material.props.api.RoomBadgeClientApi;
import com.red.circle.other.inner.model.dto.material.RoomBadgeBackpackDTO;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 房间徽章服务.
 *
 * @author pengliang on 2023/6/5
 */
@Validated
@RestController
@RequestMapping(value = RoomBadgeClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class RoomBadgeClientEndpoint implements RoomBadgeClientApi {

  private final RoomBadgeClientService roomBadgeClientService;

  @Override
  public ResultResponse<List<RoomBadgeBackpackDTO>> listBadgeBackpackByRoomId(Long roomId) {
    return ResultResponse.success(roomBadgeClientService.listBadgeBackpackByRoomId(roomId));
  }

  @Override
  public ResultResponse<Map<Long, List<RoomBadgeBackpackDTO>>> mapByRoomIds(Set<Long> roomIds) {
    return ResultResponse.success(roomBadgeClientService.mapByRoomIds(roomIds));
  }

  @Override
  public ResultResponse<List<RoomBadgeBackpackDTO>> listByRoomIds(Set<Long> roomIds) {
    return ResultResponse.success(roomBadgeClientService.listByRoomIds(roomIds));
  }

  @Override
  public ResultResponse<Boolean> activationPermanent(Long roomId, Long userId, Long badgeId) {
    return ResultResponse.success(
        roomBadgeClientService.activationPermanent(roomId, userId, badgeId));
  }

  @Override
  public ResultResponse<Boolean> activationTemporary(Long roomId, Long userId, Long badgeId,
      Integer days) {
    return ResultResponse.success(
        roomBadgeClientService.activationTemporary(roomId, userId, badgeId, days));
  }
}
