package com.red.circle.other.app.listener.strategy;

import com.red.circle.mq.business.model.event.approval.ApprovalEvent;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


/**
 * 房间公告.
 *
 * @author pengliang on 2020/12/10
 */
@Slf4j
@Component("ROOM_NOTICE_APPROVAL")
@RequiredArgsConstructor
public class RoomNoticeStrategy implements ApprovalStrategy {

  private final RoomProfileManagerService roomProfileManagerService;

  @Override
  public void doOperation(ApprovalEvent param) {
    if (param.approvalNotPass()) {
      roomProfileManagerService.updateRoomDescByIds(param.waitApprovalUserContentIds(),
          "Welcome");
    }
  }
}
