import { bookings } from "../schema.js"; import { SlotService } from "./slot-service.js"; import type { Db, BookingStatus } from "../types.js"; import type { JobsAdapter } from "@porulle/core"; interface BookingInput { providerId: string; serviceTypeId: string; customerId: string; customerName: string; customerEmail: string; customerPhone?: string | undefined; startTime: Date; paymentMethod: "card" | "cash" | "invoice"; notes?: string | undefined; metadata?: Record | undefined; } interface PaymentAdapterLike { createPaymentIntent(params: { amount: number; currency: string; orderId: string; customerId?: string | undefined; metadata?: Record | undefined; }): Promise<{ ok: true; value: { id: string; clientSecret?: string | null; }; } | { ok: false; error: { message: string; }; }>; refundPayment(paymentId: string, amount: number, reason?: string): Promise<{ ok: boolean; }>; } export declare class BookingService { private db; private slotService; private paymentAdapter?; private jobs?; private transitions; constructor(db: Db, slotService: SlotService, paymentAdapter?: PaymentAdapterLike | undefined, jobs?: JobsAdapter | undefined); private providerOrganizationId; create(input: BookingInput, txDb?: Db): Promise<{ ok: true; booking: typeof bookings.$inferSelect; paymentIntent?: { id: string; clientSecret?: string | null; } | undefined; } | { ok: false; error: string; code: string; }>; getById(id: string): Promise<{ id: string; providerId: string; serviceTypeId: string; customerId: string; customerName: string; customerEmail: string; customerPhone: string | null; startTime: Date; endTime: Date; status: string; paymentMethod: string; notes: string | null; cancellationReason: string | null; rescheduledFromId: string | null; metadata: Record | null; createdAt: Date; updatedAt: Date; } | null>; listByCustomer(customerId: string): Promise<{ id: string; providerId: string; serviceTypeId: string; customerId: string; customerName: string; customerEmail: string; customerPhone: string | null; startTime: Date; endTime: Date; status: string; paymentMethod: string; notes: string | null; cancellationReason: string | null; rescheduledFromId: string | null; metadata: Record | null; createdAt: Date; updatedAt: Date; }[]>; listByProvider(providerId: string, from?: Date, to?: Date): Promise<{ id: string; providerId: string; serviceTypeId: string; customerId: string; customerName: string; customerEmail: string; customerPhone: string | null; startTime: Date; endTime: Date; status: string; paymentMethod: string; notes: string | null; cancellationReason: string | null; rescheduledFromId: string | null; metadata: Record | null; createdAt: Date; updatedAt: Date; }[]>; changeStatus(id: string, newStatus: BookingStatus, reason?: string): Promise<{ ok: true; booking: typeof bookings.$inferSelect; } | { ok: false; error: string; }>; cancel(id: string, reason?: string): Promise<{ ok: true; booking: typeof bookings.$inferSelect; refunded: boolean; } | { ok: false; error: string; }>; reschedule(bookingId: string, newStartTime: Date, txDb?: Db): Promise<{ ok: true; oldBooking: typeof bookings.$inferSelect; newBooking: typeof bookings.$inferSelect; } | { ok: false; error: string; }>; markNoShow(id: string): Promise<{ ok: true; booking: typeof bookings.$inferSelect; } | { ok: false; error: string; }>; complete(id: string): Promise<{ ok: true; booking: typeof bookings.$inferSelect; } | { ok: false; error: string; }>; } export {}; //# sourceMappingURL=booking-service.d.ts.map