package com.red.circle.console.adapter.app.count;

import com.red.circle.console.app.dto.clienobject.count.PropsSaleCO;
import com.red.circle.console.app.dto.clienobject.count.PropsSingeSaleCO;
import com.red.circle.console.app.dto.clienobject.count.StatisticsDailyOperationActiveIndexCO;
import com.red.circle.console.app.dto.clienobject.count.user.SysOriginUserRegisterCountCO;
import com.red.circle.console.app.dto.cmd.app.count.PropsSingeSaleQryCmd;
import com.red.circle.console.app.service.app.count.CountOperationActiveIndexService;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.count.PropsSaleQuotaQryCmd;
import com.red.circle.other.inner.model.cmd.count.SysOriginUserQryCmd;
import com.red.circle.other.inner.model.dto.count.StatisticsRoomActiveDTO;
import java.util.Date;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 活跃指标.
 *
 * @author pengliang on 2022/3/24
 */
@RestController
@RequestMapping("/count/operation/active-index")
@RequiredArgsConstructor
public class OperationActiveIndexRestController extends BaseController {

  private final CountOperationActiveIndexService countOperationActiveIndexService;

  /**
   * 获取房间获取情况.
   */
  @GetMapping("/room")
  public List<StatisticsRoomActiveDTO> listRoom(
      @RequestParam Long roomId,
      @RequestParam Date startTime,
      @RequestParam Date endTime
  ) {
    return countOperationActiveIndexService.listRoomActive(roomId, startTime, endTime);
  }

  /**
   * 活跃情况指标.
   */
  @GetMapping("/user")
  public List<StatisticsDailyOperationActiveIndexCO> listLatestDays() {
    return countOperationActiveIndexService.listLatestDays(30);
  }

  /**
   * 道具销售情况-指定道具.
   */
  @GetMapping("/props-sale-singe")
  public PropsSingeSaleCO propsSale(PropsSingeSaleQryCmd qryCmd) {
    return countOperationActiveIndexService.getSingePropsSale(qryCmd);
  }

  /**
   * 道具销售情况-列表.
   */
  @GetMapping("/props-sale")
  public PropsSaleCO getPropsSale(PropsSaleQuotaQryCmd qryCmd) {
    return countOperationActiveIndexService.getPropsSale(qryCmd);
  }

  /**
   * 道具销售情况-列表.
   */
  @GetMapping("/sys-user-count")
  public SysOriginUserRegisterCountCO getSysOriginUserCount(SysOriginUserQryCmd qryCmd) {
    return countOperationActiveIndexService.getSysOriginUserCount(qryCmd);
  }

}
