import { prisma as db } from "@repo/db/client";

export const officeContactStorage = {
  async getOfficeContact(userId: number) {
    return db.officeContact.findUnique({ where: { userId } });
  },

  async upsertOfficeContact(userId: number, data: {
    officeName?: string;
    receptionistName?: string;
    dentistName?: string;
    phoneNumber?: string;
    email?: string;
    fax?: string;
    streetAddress?: string;
    city?: string;
    state?: string;
    zipCode?: string;
  }) {
    return db.officeContact.upsert({
      where: { userId },
      update: data,
      create: { userId, ...data },
    });
  },
};
