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

import com.sjyt.icom.asst.common.model.room.AbsRoom;
import com.sjyt.icom.asst.context.handle.HandleContext;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * RoomFactory
 * @author: Tab
 * @date: 2022-06-26 17:40
 * @since 1.0.0
 */
@Slf4j
@Component
@AllArgsConstructor
public class RoomFactory implements HandleContext<String, AbsRoom> {
    private final RoomFactoryOneHandle roomFactoryOneHandle;
    private final RoomFactoryMeetHandle roomFactoryMeetHandle;
    @Override
    public AbsRoom todo(String roomCode) {
        RoomFactoryHandle.Builder<String, AbsRoom> builder=new RoomFactoryHandle.Builder<>();
        builder.addHandler(roomFactoryOneHandle)
                .addHandler(roomFactoryMeetHandle);
        return builder.build().doChain(roomCode);
    }
    public AbsRoom create(String roomCode){
        return todo(roomCode);
    }
}
