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

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService;
import com.red.circle.other.infra.database.rds.service.team.RoomBdLeadService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 校验用户是否为BD.
 * </p>
 *
 * @author pengshigang
 * @since 2022-6-7
 */
@Component
@RequiredArgsConstructor
public class BdCheckQryExe {

  private final RoomBdLeadService roomBdLeadService;
  private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService;

  public Boolean execute(AppExtCommand cmd) {

    if (roomBdLeadService.checkBdLeader(cmd.requiredReqUserId())) {
      return Boolean.TRUE;
    }

    return businessDevelopmentBaseInfoService.checkBD(cmd.requiredReqUserId());
  }

}
