package com.sjyt.icom.asst.context.handle.room;

import com.sjyt.icom.asst.common.enums.RoomEnum;
import com.sjyt.icom.asst.common.model.room.ExtraInfo;
import com.sjyt.icom.asst.common.model.room.Room;
import com.sjyt.icom.asst.service.impl.RoomManageService;
import com.sjyt.icom.asst.service.impl.StreamUrlServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Optional;

/**
 * @author: Tab
 * @date: 2022-06-26 17:25
 * @since 1.0.0
 */
@Component
public class RoomFactoryMeetHandle extends RoomFactoryHandle{
    @Autowired
    public RoomFactoryMeetHandle(RoomManageService roomManage, StreamUrlServiceService urlService) {
        super(roomManage, urlService);
    }

    @Override
    public Room doChain(RoomFactoryHandleEvent event) {
        if (event.getRoomEnum().equals(RoomEnum.MEET)){
            Room room = roomManage.create(RoomEnum.MEET);
            //todo 二期
            //ExtraInfo extraInfo = initRoomData(null);
            //return Optional.ofNullable(extraInfo).map(room::addExtraInfo).orElse(null);
        }
        return handle.doChain(event);
    }
}
