import { prismaClient } from '../database/prismaClient.js';
export async function createMessage(data) {
    return prismaClient.message.create({
        data,
    });
}
export async function getMessage(chatId, messageId) {
    return prismaClient.message.findUnique({
        where: {
            chatId_messageId: {
                chatId: chatId,
                messageId: messageId,
            },
        },
    });
}
export async function getMessagesByChatId(chatId) {
    return prismaClient.message.findMany({
        where: { chatId: chatId },
    });
}
export async function getMessageCountByChatId(chatId) {
    return prismaClient.message.count({
        where: { chatId: chatId },
    });
}
export async function listMessages() {
    return prismaClient.message.findMany();
}
export async function updateMessage(chatId, messageId, data) {
    return prismaClient.message.update({
        where: {
            chatId_messageId: {
                chatId: chatId,
                messageId: messageId,
            },
        },
        data,
    });
}
export async function deleteMessage(chatId, messageId) {
    return prismaClient.message.delete({
        where: {
            chatId_messageId: {
                chatId: chatId,
                messageId: messageId,
            },
        },
    });
}
