package ch.phoenixtechnologies.lc4j.workshop;

import io.quarkus.websockets.next.OnOpen;
import io.quarkus.websockets.next.OnTextMessage;
import io.quarkus.websockets.next.WebSocket;
import io.smallrye.mutiny.Multi;

@WebSocket(path = "/customer-support-agent")
public class CustomerSupportAgentWebSocket {
    private final CustomerSupportAgent agent;

    public CustomerSupportAgentWebSocket(CustomerSupportAgent agent) {
        this.agent = agent;
    }

    @OnOpen
    public String onOpen() {
        return "Welcome to Phoenix Technologies AI!";
    }

    @OnTextMessage
    public Multi<String> onTextMessage(String message) {
        return agent.chat(message);
    }
}
