import { type SortOption } from '@unchainedshop/utils'; import { type Enrollment, type EnrollmentPeriod, type EnrollmentPlan, EnrollmentStatus } from '../db/EnrollmentsCollection.ts'; import { mongodb, type Address, type Contact, type ModuleInput } from '@unchainedshop/mongodb'; import { type EnrollmentsSettingsOptions } from '../enrollments-settings.ts'; export interface EnrollmentQuery { status?: EnrollmentStatus[]; userId?: string; queryString?: string; } export declare const buildFindSelector: ({ queryString, status, userId }: EnrollmentQuery) => mongodb.Filter; export declare const configureEnrollmentsModule: ({ db, migrationRepository, options: enrollmentOptions, }: ModuleInput) => Promise<{ count: (query: EnrollmentQuery) => Promise; openEnrollmentWithProduct: ({ productId }: { productId: string; }) => Promise | null>; findEnrollment: (params: { enrollmentId: string; } | { orderId: string; }, options?: mongodb.FindOptions) => Promise; findEnrollmentsByOrderIds: ({ orderIds }: { orderIds: string[]; }, options?: mongodb.FindOptions) => Promise; findEnrollments: ({ limit, offset, sort, ...query }: EnrollmentQuery & { limit?: number; offset?: number; sort?: SortOption[]; }) => Promise; normalizedStatus: (enrollment: Enrollment) => EnrollmentStatus; isExpired: (enrollment: Enrollment, { referenceDate }: { referenceDate?: Date; }) => boolean; addEnrollmentPeriod: (enrollmentId: string, period: EnrollmentPeriod) => Promise | null>; create: ({ countryCode, currencyCode, ...enrollmentData }: Omit & Pick, "_id" | "created">) => Promise; delete: (enrollmentId: string) => Promise; removeEnrollmentPeriodByOrderId: (enrollmentId: string, orderId: string) => Promise | null>; updateBillingAddress: (enrollmentId: string, fieldValue: Address) => Promise | null>; updateContact: (enrollmentId: string, contact: Contact) => Promise | null>; updateContext: (enrollmentId: string, fieldValue: any) => Promise | null>; updateDelivery: (enrollmentId: string, fieldValue: { deliveryProviderId?: string; context?: any; }) => Promise | null>; updatePayment: (enrollmentId: string, fieldValue: { paymentProviderId: string; context?: any; } | undefined) => Promise | null>; updatePlan: (enrollmentId: string, plan: EnrollmentPlan) => Promise | null>; updateStatus: (enrollmentId: string, { status, info }: { status: EnrollmentStatus; info?: string; }) => Promise | null>; deleteInactiveUserEnrollments: (userId: string) => Promise; }>; export type EnrollmentsModule = Awaited>;