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

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.inner.model.dto.agency.agency.TeamExchangeSurplusTargetDTO;
import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO;
import com.red.circle.other.inner.model.dto.agency.agency.TeamProfileDTO;
import com.red.circle.other.inner.model.dto.agency.agency.UserTeamRegionDTO;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
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;

/**
 * 代理团队.
 *
 * @author pengliang on 2023/6/1
 */
public interface AgentTeamClientApi {

  String API_PREFIX = "/team/client";

  /**
   * 是否存在，团队成员.
   *
   * @return true 是，false 不是
   */
  @GetMapping("/existsTeamMember")
  ResultResponse<Boolean> existsTeamMember(@RequestParam("userId") Long userId);

  /**
   * 是否存在拥有者.
   *
   * @return true 是，false 不是
   */
  @GetMapping("/existsTeamOwn")
  ResultResponse<Boolean> existsTeamOwn(@RequestParam("userId") Long userId);

  /**
   * 刷新成员活跃时间.
   */
  @GetMapping("/refreshActiveTime")
  ResultResponse<Void> refreshActiveTime(@RequestParam("userId") Long userId);

  /**
   * 获取成员信息.
   */
  @GetMapping("/getByMemberId")
  ResultResponse<TeamMemberDTO> getByMemberId(@RequestParam("memberId") Long memberId);

  /**
   * 获取一组指定成员信息.
   */
  @PostMapping("/mapByMemberIds")
  ResultResponse<Map<Long, TeamMemberDTO>> mapByMemberIds(@RequestBody Collection<Long> memberIds);

  /**
   * 团队资料映射
   */
  @PostMapping("/mapProfileByProfileIds")
  ResultResponse<Map<Long, TeamProfileDTO>> mapProfileByProfileIds(@RequestBody Set<Long> ids);

  /**
   * 获取团队资料
   */
  @GetMapping("/getProfileByOwnUserId")
  ResultResponse<TeamProfileDTO> getProfileByOwnUserId(@RequestParam("ownUserId") Long ownUserId);

  /**
   * 获取用户所在团队资料.
   */
  @GetMapping("/getProfileByMemberId")
  ResultResponse<TeamProfileDTO> getProfileByMemberId(@RequestParam("memberId") Long memberId);

  /**
   * 用户所在团队，区域信息.
   */
  @PostMapping("/listUserTeamRegion")
  ResultResponse<List<UserTeamRegionDTO>> listUserTeamRegion(@RequestBody Set<Long> userIds);

  /**
   * 获取指定团队资料.
   */
  @GetMapping("/getProfileById")
  ResultResponse<TeamProfileDTO> getProfileById(@RequestParam("id") Long id);

  /**
   * 获取存在的成员用户id.
   */
  @PostMapping("/listMemberIds")
  ResultResponse<List<Long>> listMemberIds(@RequestBody Set<Long> userIds);

  @GetMapping("/test")
  ResultResponse<Void> test();

  @GetMapping("/listByCondition")
  ResultResponse<List<TeamExchangeSurplusTargetDTO>> listByCondition(
      @RequestParam(value = "lastId", required = false) Long lastId,
      @RequestParam(value = "userId", required = false) Long userId,
      @RequestParam(value = "sysOrigin", required = false) String sysOrigin,
      @RequestParam(value = "dateNumber", required = false) Integer dateNumber);

  @GetMapping("/getTotalAmountUsd")
  ResultResponse<String> getTotalAmountUsd(
      @RequestParam(value = "lastId", required = false) Long userId,
      @RequestParam(value = "sysOrigin", required = false) String sysOrigin,
      @RequestParam(value = "dateNumber", required = false) Integer dateNumber);
}
