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.bd.BdTeamLeaderAddCmd;
import com.red.circle.other.inner.model.cmd.team.bd.BdTeamLeaderOpsPageQryCmd;
import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO;
import com.red.circle.other.inner.model.dto.agency.bd.BdTeamLeaderDTO;
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 leader.
 *
 * @author pengliang on 2023/11/21
 */
public interface BdTeamLeaderClientApi {

  String API_PREFIX = "/bd/team/leader/client";

  /**
   * 获取bd leader信息.
   */
  @GetMapping("/getById")
  ResultResponse<BdTeamLeaderDTO> getById(@RequestParam("id") Long id);

  /**
   * 根据用户id 获取bd leader信息.
   */
  @GetMapping("/getByUserId")
  ResultResponse<BdTeamLeaderDTO> getByUserId(@RequestParam("userId") Long userId);

  /**
   * 统计bd leader 主播成员.
   */
  @GetMapping("/countBdByLeaderUserId")
  ResultResponse<Long> countBdByLeaderUserId(@RequestParam("leadUserId") Long leadUserId);

  /**
   * 获取bd leader 成员.
   */
  @GetMapping("/listByLeaderUserId")
  ResultResponse<List<BdTeamInfoDTO>> listByLeaderUserId(
      @RequestParam("leadUserId") Long leadUserId,
      @RequestParam("lastId") Long lastId
  );

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

  /**
   * 校验是否是BdLead.
   */
  @GetMapping("/check")
  ResultResponse<Boolean> check(@RequestParam("userId") Long userId);

  /**
   * 获取leader分页列表（运营后台）
   */
  @PostMapping("/pageOps")
  ResultResponse<PageResult<BdTeamLeaderDTO>> pageOps(
      @RequestBody BdTeamLeaderOpsPageQryCmd qryCmd);

  /**
   * 根据lead查询名下bd成员数量.
   */
  @PostMapping("/mapCountByLeadUserIds")
  ResultResponse<Map<Long, Long>> mapCountByLeadUserIds(@RequestBody Set<Long> bdLeadUserIds);

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

  /**
   * 获取团队下的bd，用户.
   */
  @PostMapping("/mapTeamBdUserId")
  ResultResponse<Map<Long, Long>> mapTeamBdUserId(@RequestBody Set<Long> collect);

  /**
   * 移除leader.
   */
  @GetMapping("/removeLeader")
  ResultResponse<Void> removeLeader(
      @RequestParam("teamId") Long teamId,
      @RequestParam("bdLeadUserId") Long bdLeadUserId
  );

}
