import { prisma } from '../../../lib/prisma';

export class SupportService {
  async getAllTickets() {
    return await prisma.supportTicket.findMany({
      include: {
        user: true
      }
    });
  }

  async getTicketById(id: string) {
    return await prisma.supportTicket.findUnique({
      where: { id },
      include: {
        user: true
      }
    });
  }

  async createTicket(ticketData: any) {
    return await prisma.supportTicket.create({
      data: ticketData
    });
  }

  async updateTicketStatus(id: string, status: string) {
    return await prisma.supportTicket.update({
      where: { id },
      data: { status }
    });
  }

  async deleteTicket(id: string) {
    await prisma.supportTicket.delete({ where: { id } });
    return true;
  }
}

export default SupportService;
