package com.red.circle.other.app.inner.endpoint.activity;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.activity.RoomContributionActivityCountClientService;
import com.red.circle.other.inner.endpoint.activity.api.RoomContributionActivityCountClientApi;
import com.red.circle.other.inner.model.dto.activity.RoomContributionActivityCountDTO;
import java.util.List;
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/11/2
 */
@Validated
@RestController
@RequestMapping(value = RoomContributionActivityCountClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class RoomContributionActivityCountClientEndpoint implements
    RoomContributionActivityCountClientApi {

  private final RoomContributionActivityCountClientService roomContributionActivityCountClientService;

  @Override
  public ResultResponse<PageResult<RoomContributionActivityCountDTO>> pageReceived(Long roomId,
      Integer current, Integer limitSize) {
    return ResultResponse.success(
        roomContributionActivityCountClientService.pageReceived(roomId, current, limitSize)
    );
  }

  @Override
  public ResultResponse<List<RoomContributionActivityCountDTO>> listLastWeek() {
    return ResultResponse.success(roomContributionActivityCountClientService.listLastWeek());
  }

  @Override
  public ResultResponse<List<RoomContributionActivityCountDTO>> listCurrentWeek(Integer limit) {
    return ResultResponse.success(roomContributionActivityCountClientService.listCurrentWeek(limit));
  }

  @Override
  public ResultResponse<RoomContributionActivityCountDTO> getCurrentWeek(Long roomId) {
    return ResultResponse.success(
        roomContributionActivityCountClientService.getCurrentWeek(roomId)
    );
  }

  @Override
  public ResultResponse<Boolean> updateRewardCoinsSent(String id) {
    return ResultResponse.success(
        roomContributionActivityCountClientService.updateRewardCoinsSent(id)
    );
  }

}
