import { Factory } from "fishery"; import { ObjectId } from "mongodb"; import { faker } from "@faker-js/faker"; import type { Call } from "../../../talkpilot"; export const callFactory = Factory.define(() => ({ callSid: faker.string.uuid(), flowId: new ObjectId(), clientId: faker.string.uuid(), sessionId: null, resultId: new ObjectId(), customerPhoneNumber: faker.phone.number(), agentPhoneNumber: faker.phone.number(), isIncomingCall: false, isOutgoingCall: true, callLength: faker.number.int({ min: 0, max: 3600 }), env: "test", updatedAt: new Date(), createdAt: new Date(), })); export function createOutGoingCallDoc(overrides?: Partial): Call { return callFactory.build({ ...overrides, isIncomingCall: false, isOutgoingCall: true, }); } export function createIncomingCallDoc(overrides?: Partial): Call { return callFactory.build({ ...overrides, isIncomingCall: true, isOutgoingCall: false, sessionId: overrides?.sessionId ?? null, }); }