package com.red.circle.other.inner.endpoint.team.bd.api;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.inner.model.cmd.team.BdTeamInfoCmd;
import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd;
import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd;
import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd;
import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd;
import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * bd 团队.
 *
 * @author pengliang on 2023/5/26
 */
public interface BdTeamInfoClientApi {

  String API_PREFIX = "/bd/team-info/client";

  /**
   * 是否是bd.
   *
   * @return true 是，false 不是
   */
  @GetMapping("/check")
  ResultResponse<Boolean> check(@RequestParam("userId") Long userId);

  /**
   * 获取用户团队.
   */
  @GetMapping("/getByUserId")
  ResultResponse<BdTeamInfoDTO> getByUserId(@RequestParam("userId") Long userId);

  /**
   * 获取团队.
   */
  @GetMapping("/getById")
  ResultResponse<BdTeamInfoDTO> getById(@RequestParam("id") Long id);

  /**
   * 添加: bd.
   */
  @PostMapping("/add")
  ResultResponse<Void> add(@RequestBody @Validated BdTeamInfoCmd cmd);

  /**
   * 累加成员数.
   */
  @PostMapping("/incrMemberCount")
  ResultResponse<Void> incrMemberCount(@RequestBody Set<Long> userIds);


  @PostMapping("/mapCheckBd")
  ResultResponse<Map<Long, Boolean>> mapCheckBd(@RequestBody Set<Long> userIds);

  /**
   * 修改bd信息.
   */
  @PostMapping("/updateSelectiveById")
  ResultResponse<Void> updateSelectiveById(@RequestBody @Validated BdTeamInfoDTO dto);

  /**
   * 修改BD信息.
   */
  @PostMapping("/updateOpsById")
  ResultResponse<Void> updateOpsById(@RequestBody @Validated BdTeamUpdateOpsCmd cmd);

  /**
   * 扣除成员计算.
   */
  @PostMapping("/decrMemberCount")
  ResultResponse<Void> decrMemberCount(@RequestBody Set<Long> userIds);


  /**
   * 获取BD分页列表(运营后台)
   */
  @PostMapping("/pageOps")
  ResultResponse<PageResult<BdTeamInfoDTO>> pageOps(@RequestBody BdTeamPageQryCmd qryCmd);

  /**
   * 获取BD分页列表(运营后台)
   */
  @PostMapping("/pageWorkStatistics")
  ResultResponse<List<BdTeamInfoDTO>> pageWorkStatistics(@RequestBody BdTeamWorkStatisticsQryCmd qryCmd);

  /**
   * 移除指定记录.
   */
  @GetMapping("/deleteById")
  ResultResponse<Void> deleteById(@RequestParam("id") Long id);

  /**
   * 换绑BD Leader.
   */
  @PostMapping("/changeBdLeader")
  ResultResponse<Void> changeBdLeader(@RequestBody @Validated ChangeBdLeaderCmd cmd);

}
