package tech.easyflow.chatlog.service.impl;

import org.springframework.stereotype.Service;
import tech.easyflow.chatlog.domain.command.ChatSessionUpsertCommand;
import tech.easyflow.chatlog.domain.dto.ChatSessionSummary;
import tech.easyflow.chatlog.service.ChatPersistDispatcher;
import tech.easyflow.chatlog.service.ChatSessionCommandService;

import java.math.BigInteger;

@Service
public class ChatSessionCommandServiceImpl implements ChatSessionCommandService {

    private final ChatPersistDispatcher chatPersistDispatcher;

    public ChatSessionCommandServiceImpl(ChatPersistDispatcher chatPersistDispatcher) {
        this.chatPersistDispatcher = chatPersistDispatcher;
    }

    @Override
    public ChatSessionSummary createOrTouchSession(ChatSessionUpsertCommand command) {
        return chatPersistDispatcher.createOrTouchSession(command);
    }

    @Override
    public void renameSession(BigInteger sessionId, BigInteger userId, String title, BigInteger operatorId) {
        chatPersistDispatcher.renameSession(sessionId, userId, title, operatorId);
    }

    @Override
    public void deleteSession(BigInteger sessionId, BigInteger userId, BigInteger operatorId) {
        chatPersistDispatcher.deleteSession(sessionId, userId, operatorId);
    }
}
