package com.red.circle.other.app.command.user.query;

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.other.app.dto.clientobject.user.relation.friendcard.UserFriendCardCountMessageCO;
import com.red.circle.other.infra.database.mongo.service.user.friend.FriendsApplyListService;
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService;
import com.red.circle.other.infra.database.rds.service.user.user.GiveFriendshipCardApplyService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 统计未同意友谊关系卡申请、好友申请、我的消息列表
 *
 * @author zongpubin on 2023/12/5
 */
@Service
@AllArgsConstructor
public class UserCountMessageQryExe {

  private final DynamicMessageService dynamicMessageService;

  private final FriendsApplyListService friendsApplyListService;
  private final GiveFriendshipCardApplyService giveFriendshipCardApplyService;

  public UserFriendCardCountMessageCO execute(AppExtCommand cmd) {

    return new UserFriendCardCountMessageCO()
        .setUserFriendApplyNum(giveFriendshipCardApplyService.countFriendshipCardApply(
            cmd.getReqUserId()))
        .setUserFriendApplyNum(friendsApplyListService.countFriendsApply(cmd.getReqUserId()))
        .setDynamicMessageNum(
            dynamicMessageService.countDynamicMessage(cmd.getReqUserId()));
  }
}
