import { Factory } from "fishery"; import { ObjectId } from "mongodb"; import { faker } from "@faker-js/faker"; import type { Flow } from "../../../talkpilot"; export const flowFactory = Factory.define(() => { const now = new Date(); return { _id: new ObjectId(), flowName: faker.lorem.words(2), clientId: faker.string.uuid(), systemInstructions: faker.lorem.sentences(2), initialSentence: faker.lorem.sentence(), insights: [], interactions: [], createdAt: now, updatedAt: now, }; }); export function createFlow( overrides?: Partial, ): Flow & { _id: ObjectId } { const now = new Date(); const base = flowFactory.build(); return { ...base, ...overrides, _id: (overrides?._id as ObjectId) ?? base._id, updatedAt: now, createdAt: overrides?.createdAt ?? now, }; }