@atzentis/booking-sdk 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -538,6 +538,478 @@ declare class AvailabilityService extends BaseService {
538
538
  getPricing(params: PricingParams): Promise<PricingResult>;
539
539
  }
540
540
 
541
+ /**
542
+ * All supported booking types across the three verticals.
543
+ *
544
+ * - **Stays:** `stay`, `dayuse`
545
+ * - **Tables:** `table`
546
+ * - **Services:** `service`
547
+ * - **Universal:** `parking`, `desk`, `meeting`, `custom`
548
+ */
549
+ type BookingType = "stay" | "table" | "service" | "parking" | "desk" | "meeting" | "dayuse" | "custom";
550
+ /** All 8 booking types as a readonly tuple for runtime enumeration */
551
+ declare const BOOKING_TYPES: readonly ["stay", "table", "service", "parking", "desk", "meeting", "dayuse", "custom"];
552
+ /**
553
+ * Booking lifecycle statuses.
554
+ *
555
+ * State machine:
556
+ * ```
557
+ * pending ──→ confirmed ──→ checked_in ──→ checked_out
558
+ * │ │ │
559
+ * ├─→ cancelled ├─→ cancelled ├─→ cancelled
560
+ * ├─→ waitlist └─→ no_show └─→ no_show
561
+ * └─→ no_show
562
+ * ```
563
+ */
564
+ type BookingStatus = "pending" | "confirmed" | "checked_in" | "checked_out" | "cancelled" | "no_show" | "waitlist";
565
+ /** All 7 booking statuses as a readonly tuple for runtime enumeration */
566
+ declare const BOOKING_STATUSES: readonly ["pending", "confirmed", "checked_in", "checked_out", "cancelled", "no_show", "waitlist"];
567
+ /** Guest summary embedded in a booking */
568
+ interface BookingGuest {
569
+ /** Guest identifier */
570
+ id: string;
571
+ /** Guest first name */
572
+ firstName: string;
573
+ /** Guest last name */
574
+ lastName: string;
575
+ /** Guest email address */
576
+ email: string | null;
577
+ /** Guest phone number */
578
+ phone: string | null;
579
+ }
580
+ /** Space summary embedded in a booking */
581
+ interface BookingSpace {
582
+ /** Space identifier */
583
+ id: string;
584
+ /** Display name of the space */
585
+ name: string;
586
+ /** Space type (room, table, service, etc.) */
587
+ type: SpaceType;
588
+ /** Category the space belongs to */
589
+ categoryId: string | null;
590
+ /** Floor the space is on */
591
+ floor: string | null;
592
+ }
593
+ /** Pricing breakdown for a booking */
594
+ interface BookingPricing {
595
+ /** Total price in cents */
596
+ total: number;
597
+ /** Per-night rate in cents, null for non-Stays verticals */
598
+ perNight: number | null;
599
+ /** ISO 4217 currency code (e.g., "EUR", "USD") */
600
+ currency: string;
601
+ /** Tax amount in cents */
602
+ taxes: number;
603
+ /** Fee amount in cents */
604
+ fees: number;
605
+ }
606
+ /** A booking in the Atzentis Booking system */
607
+ interface Booking {
608
+ /** Booking identifier */
609
+ id: string;
610
+ /** Human-readable confirmation code */
611
+ confirmationCode: string;
612
+ /** Property this booking belongs to */
613
+ propertyId: string;
614
+ /** Category for the booked space */
615
+ categoryId: string | null;
616
+ /** Guest who made the booking */
617
+ guestId: string;
618
+ /** Assigned space, null until assigned */
619
+ spaceId: string | null;
620
+ /** Booking type */
621
+ type: BookingType;
622
+ /** Current lifecycle status */
623
+ status: BookingStatus;
624
+ /** Check-in date in YYYY-MM-DD format */
625
+ checkIn: string;
626
+ /** Check-out date in YYYY-MM-DD format */
627
+ checkOut: string;
628
+ /** Number of guests */
629
+ guests: number;
630
+ /** Free-text notes */
631
+ notes: string | null;
632
+ /** Booking source (e.g., "website", "phone", "walk-in") */
633
+ source: string | null;
634
+ /** Rate plan identifier */
635
+ rateId: string | null;
636
+ /** Open bag for custom data */
637
+ metadata: Record<string, unknown> | null;
638
+ /** Guest summary */
639
+ guest: BookingGuest | null;
640
+ /** Assigned space summary */
641
+ space: BookingSpace | null;
642
+ /** Pricing breakdown */
643
+ pricing: BookingPricing | null;
644
+ /** When the booking was confirmed */
645
+ confirmedAt: string | null;
646
+ /** When the guest checked in */
647
+ checkedInAt: string | null;
648
+ /** When the guest checked out */
649
+ checkedOutAt: string | null;
650
+ /** When the booking was cancelled */
651
+ cancelledAt: string | null;
652
+ /** Cancellation reason, populated on cancel */
653
+ cancellationReason: string | null;
654
+ /** When the booking was marked as no-show */
655
+ noShowAt: string | null;
656
+ /** Record creation timestamp */
657
+ createdAt: string;
658
+ /** Record last-update timestamp */
659
+ updatedAt: string;
660
+ }
661
+ /** Input for creating a new booking */
662
+ interface CreateBookingInput {
663
+ /** Property to create the booking for */
664
+ propertyId: string;
665
+ /** Category for the booked space */
666
+ categoryId: string;
667
+ /** Guest identifier */
668
+ guestId: string;
669
+ /** Check-in date in YYYY-MM-DD format */
670
+ checkIn: string;
671
+ /** Check-out date in YYYY-MM-DD format */
672
+ checkOut: string;
673
+ /** Booking type */
674
+ type: BookingType;
675
+ /** Number of guests */
676
+ guests?: number;
677
+ /** Assign a specific space */
678
+ spaceId?: string;
679
+ /** Free-text notes */
680
+ notes?: string;
681
+ /** Booking source */
682
+ source?: string;
683
+ /** Rate plan identifier */
684
+ rateId?: string;
685
+ /** Custom metadata */
686
+ metadata?: Record<string, unknown>;
687
+ /** Auto-confirm the booking on creation */
688
+ autoConfirm?: boolean;
689
+ }
690
+ /** Input for updating an existing booking — all fields optional */
691
+ interface UpdateBookingInput {
692
+ /** Update the category */
693
+ categoryId?: string;
694
+ /** Update check-in date */
695
+ checkIn?: string;
696
+ /** Update check-out date */
697
+ checkOut?: string;
698
+ /** Update number of guests */
699
+ guests?: number;
700
+ /** Update notes */
701
+ notes?: string;
702
+ /** Update source */
703
+ source?: string;
704
+ /** Update rate plan */
705
+ rateId?: string;
706
+ /** Update metadata */
707
+ metadata?: Record<string, unknown>;
708
+ }
709
+ /** Input for check-in operation */
710
+ interface CheckInInput {
711
+ /** Actual arrival time in ISO 8601 format */
712
+ actualArrival?: string;
713
+ /** Check-in notes */
714
+ notes?: string;
715
+ /** Assign or change space at check-in */
716
+ spaceId?: string;
717
+ }
718
+ /** Input for check-out operation */
719
+ interface CheckOutInput {
720
+ /** Actual departure time in ISO 8601 format */
721
+ actualDeparture?: string;
722
+ /** Check-out notes */
723
+ notes?: string;
724
+ }
725
+ /** Input for cancel operation */
726
+ interface CancelBookingInput {
727
+ /** Cancellation reason (required) */
728
+ reason: string;
729
+ /** Who cancelled the booking */
730
+ cancelledBy?: string;
731
+ /** Whether a refund was requested */
732
+ refundRequested?: boolean;
733
+ }
734
+ /** Input for no-show operation */
735
+ interface NoShowInput {
736
+ /** No-show notes */
737
+ notes?: string;
738
+ /** Whether to charge a no-show fee */
739
+ chargeNoShowFee?: boolean;
740
+ }
741
+ /** Input for space assignment */
742
+ interface AssignSpaceInput {
743
+ /** Space to assign (required) */
744
+ spaceId: string;
745
+ /** Assignment notes */
746
+ notes?: string;
747
+ }
748
+ /** Sort configuration for booking list queries */
749
+ interface BookingSort {
750
+ /** Field to sort by */
751
+ field: "checkIn" | "checkOut" | "createdAt" | "updatedAt" | "status";
752
+ /** Sort direction */
753
+ direction: "asc" | "desc";
754
+ }
755
+ /** Query parameters for listing bookings */
756
+ interface ListBookingsParams {
757
+ /** Property to list bookings for (required) */
758
+ propertyId: string;
759
+ /** Filter by status (single or array) */
760
+ status?: BookingStatus | BookingStatus[];
761
+ /** Filter by type (single or array) */
762
+ type?: BookingType | BookingType[];
763
+ /** Filter by guest */
764
+ guestId?: string;
765
+ /** Filter by check-in date (from) */
766
+ checkInFrom?: string;
767
+ /** Filter by check-in date (to) */
768
+ checkInTo?: string;
769
+ /** Filter by check-out date (from) */
770
+ checkOutFrom?: string;
771
+ /** Filter by check-out date (to) */
772
+ checkOutTo?: string;
773
+ /** Search by confirmation code or guest name */
774
+ search?: string;
775
+ /** Sort configuration */
776
+ sort?: BookingSort;
777
+ /** Maximum results per page */
778
+ limit?: number;
779
+ /** Pagination cursor */
780
+ cursor?: string;
781
+ }
782
+ /** Paginated list of bookings */
783
+ interface PaginatedBookings {
784
+ /** Bookings in this page */
785
+ data: Booking[];
786
+ /** Total number of matching bookings */
787
+ totalCount: number;
788
+ /** Cursor for next page, null if no more results */
789
+ cursor: string | null;
790
+ /** Whether more results are available */
791
+ hasMore: boolean;
792
+ }
793
+
794
+ /**
795
+ * Service for managing bookings in the Atzentis Booking API.
796
+ *
797
+ * Provides full CRUD operations and lifecycle management across all
798
+ * 8 booking types (stay, table, service, parking, desk, meeting, dayuse, custom)
799
+ * and 7 statuses (pending, confirmed, checked_in, checked_out, cancelled, no_show, waitlist).
800
+ *
801
+ * **Lifecycle state machine:**
802
+ * ```
803
+ * pending ──→ confirmed ──→ checked_in ──→ checked_out
804
+ * │ │ │
805
+ * ├─→ cancelled ├─→ cancelled ├─→ cancelled
806
+ * ├─→ waitlist └─→ no_show └─→ no_show
807
+ * └─→ no_show
808
+ * ```
809
+ *
810
+ * @example
811
+ * ```typescript
812
+ * const booking = new BookingClient({ apiKey: "atz_io_live_xxxxx" });
813
+ *
814
+ * // Create a stay booking
815
+ * const newBooking = await booking.bookings.create({
816
+ * propertyId: "prop_abc123",
817
+ * categoryId: "cat_deluxe",
818
+ * guestId: "guest_42",
819
+ * checkIn: "2025-07-01",
820
+ * checkOut: "2025-07-05",
821
+ * type: "stay",
822
+ * });
823
+ *
824
+ * // Lifecycle: confirm → check-in → check-out
825
+ * await booking.bookings.confirm(newBooking.id);
826
+ * await booking.bookings.checkIn(newBooking.id);
827
+ * await booking.bookings.checkOut(newBooking.id);
828
+ * ```
829
+ */
830
+ declare class BookingsService extends BaseService {
831
+ protected readonly basePath = "/booking/v1/bookings";
832
+ /**
833
+ * Create a new booking.
834
+ *
835
+ * @example
836
+ * ```typescript
837
+ * const booking = await client.bookings.create({
838
+ * propertyId: "prop_abc123",
839
+ * categoryId: "cat_deluxe",
840
+ * guestId: "guest_42",
841
+ * checkIn: "2025-07-01",
842
+ * checkOut: "2025-07-05",
843
+ * type: "stay",
844
+ * guests: 2,
845
+ * autoConfirm: true,
846
+ * });
847
+ * ```
848
+ */
849
+ create(input: CreateBookingInput): Promise<Booking>;
850
+ /**
851
+ * Get a single booking by ID.
852
+ *
853
+ * @example
854
+ * ```typescript
855
+ * const booking = await client.bookings.get("bk_abc123");
856
+ * ```
857
+ */
858
+ get(bookingId: string): Promise<Booking>;
859
+ /**
860
+ * List bookings for a property with optional filters and cursor-based pagination.
861
+ *
862
+ * Supports filtering by status, type, guest, date ranges, search term,
863
+ * and custom sort order. Array values for `status` and `type` are serialized
864
+ * as comma-separated strings.
865
+ *
866
+ * @example
867
+ * ```typescript
868
+ * // List all confirmed stay bookings
869
+ * const page = await client.bookings.list({
870
+ * propertyId: "prop_abc123",
871
+ * status: "confirmed",
872
+ * type: "stay",
873
+ * });
874
+ *
875
+ * // Multi-status filter with date range
876
+ * const page2 = await client.bookings.list({
877
+ * propertyId: "prop_abc123",
878
+ * status: ["confirmed", "checked_in"],
879
+ * checkInFrom: "2025-07-01",
880
+ * checkInTo: "2025-07-31",
881
+ * sort: { field: "checkIn", direction: "asc" },
882
+ * limit: 20,
883
+ * });
884
+ * ```
885
+ */
886
+ list(params: ListBookingsParams): Promise<PaginatedBookings>;
887
+ /**
888
+ * Update an existing booking.
889
+ *
890
+ * @example
891
+ * ```typescript
892
+ * const updated = await client.bookings.update("bk_abc123", {
893
+ * guests: 3,
894
+ * notes: "Extra bed requested",
895
+ * });
896
+ * ```
897
+ */
898
+ update(bookingId: string, input: UpdateBookingInput): Promise<Booking>;
899
+ /**
900
+ * Delete a booking.
901
+ *
902
+ * @example
903
+ * ```typescript
904
+ * await client.bookings.delete("bk_abc123");
905
+ * ```
906
+ */
907
+ delete(bookingId: string): Promise<void>;
908
+ /**
909
+ * Confirm a pending booking.
910
+ *
911
+ * Transitions: `pending` → `confirmed`
912
+ *
913
+ * @throws {ConflictError} 409 if the booking is not in `pending` status
914
+ *
915
+ * @example
916
+ * ```typescript
917
+ * const confirmed = await client.bookings.confirm("bk_abc123");
918
+ * // confirmed.status === "confirmed"
919
+ * // confirmed.confirmedAt is populated
920
+ * ```
921
+ */
922
+ confirm(bookingId: string): Promise<Booking>;
923
+ /**
924
+ * Check in a guest.
925
+ *
926
+ * Transitions: `confirmed` → `checked_in`
927
+ *
928
+ * @throws {ConflictError} 409 if the booking is not in `confirmed` status
929
+ *
930
+ * @example
931
+ * ```typescript
932
+ * const checkedIn = await client.bookings.checkIn("bk_abc123", {
933
+ * actualArrival: "2025-07-01T14:30:00Z",
934
+ * });
935
+ * // checkedIn.status === "checked_in"
936
+ * // checkedIn.checkedInAt is populated
937
+ * ```
938
+ */
939
+ checkIn(bookingId: string, input?: CheckInInput): Promise<Booking>;
940
+ /**
941
+ * Check out a guest.
942
+ *
943
+ * Transitions: `checked_in` → `checked_out`
944
+ *
945
+ * @throws {ConflictError} 409 if the booking is not in `checked_in` status
946
+ *
947
+ * @example
948
+ * ```typescript
949
+ * const checkedOut = await client.bookings.checkOut("bk_abc123", {
950
+ * actualDeparture: "2025-07-05T11:00:00Z",
951
+ * });
952
+ * // checkedOut.status === "checked_out"
953
+ * // checkedOut.checkedOutAt is populated
954
+ * ```
955
+ */
956
+ checkOut(bookingId: string, input?: CheckOutInput): Promise<Booking>;
957
+ /**
958
+ * Cancel a booking.
959
+ *
960
+ * Transitions: `pending` | `confirmed` | `checked_in` → `cancelled`
961
+ *
962
+ * @throws {ConflictError} 409 if the booking is already cancelled, checked out, or no-show
963
+ *
964
+ * @example
965
+ * ```typescript
966
+ * const cancelled = await client.bookings.cancel("bk_abc123", {
967
+ * reason: "Guest requested cancellation",
968
+ * refundRequested: true,
969
+ * });
970
+ * // cancelled.status === "cancelled"
971
+ * // cancelled.cancelledAt is populated
972
+ * // cancelled.cancellationReason === "Guest requested cancellation"
973
+ * ```
974
+ */
975
+ cancel(bookingId: string, input: CancelBookingInput): Promise<Booking>;
976
+ /**
977
+ * Mark a booking as no-show.
978
+ *
979
+ * Transitions: `pending` | `confirmed` | `checked_in` → `no_show`
980
+ *
981
+ * @throws {ConflictError} 409 if the booking is already checked out, cancelled, or no-show
982
+ *
983
+ * @example
984
+ * ```typescript
985
+ * const noShow = await client.bookings.noShow("bk_abc123", {
986
+ * chargeNoShowFee: true,
987
+ * });
988
+ * // noShow.status === "no_show"
989
+ * // noShow.noShowAt is populated
990
+ * ```
991
+ */
992
+ noShow(bookingId: string, input?: NoShowInput): Promise<Booking>;
993
+ /**
994
+ * Assign or reassign a space to a booking.
995
+ *
996
+ * Can be called on any active booking (pending, confirmed, checked_in).
997
+ *
998
+ * @throws {ConflictError} 409 if the booking is in a terminal status
999
+ *
1000
+ * @example
1001
+ * ```typescript
1002
+ * const assigned = await client.bookings.assignSpace("bk_abc123", {
1003
+ * spaceId: "spc_room101",
1004
+ * notes: "Upgraded to deluxe",
1005
+ * });
1006
+ * // assigned.spaceId === "spc_room101"
1007
+ * // assigned.space is populated
1008
+ * ```
1009
+ */
1010
+ assignSpace(bookingId: string, input: AssignSpaceInput): Promise<Booking>;
1011
+ }
1012
+
541
1013
  /** All supported property types in the v4.0 API */
542
1014
  type PropertyType = "hotel" | "resort" | "villa" | "apartment" | "hostel" | "bnb" | "restaurant" | "cafe" | "bar" | "beach" | "spa" | "salon" | "custom";
543
1015
  /** Property lifecycle status */
@@ -725,6 +1197,581 @@ declare class CategoriesService extends BaseService {
725
1197
  delete(categoryId: string): Promise<void>;
726
1198
  }
727
1199
 
1200
+ /** Guest address */
1201
+ interface GuestAddress {
1202
+ /** Street address */
1203
+ street: string | null;
1204
+ /** City */
1205
+ city: string | null;
1206
+ /** State or province */
1207
+ state: string | null;
1208
+ /** Postal/ZIP code */
1209
+ postalCode: string | null;
1210
+ /** ISO 3166-1 alpha-2 country code */
1211
+ country: string | null;
1212
+ }
1213
+ /** A guest profile in the Atzentis system */
1214
+ interface Guest {
1215
+ /** Guest identifier */
1216
+ id: string;
1217
+ /** First name */
1218
+ firstName: string;
1219
+ /** Last name */
1220
+ lastName: string;
1221
+ /** Email address */
1222
+ email: string | null;
1223
+ /** Phone number */
1224
+ phone: string | null;
1225
+ /** Date of birth in YYYY-MM-DD format */
1226
+ dateOfBirth: string | null;
1227
+ /** ISO 3166-1 alpha-2 nationality code */
1228
+ nationality: string | null;
1229
+ /** ISO 639-1 language code */
1230
+ language: string | null;
1231
+ /** Guest address */
1232
+ address: GuestAddress | null;
1233
+ /** Company name */
1234
+ company: string | null;
1235
+ /** Passport number */
1236
+ passportNumber: string | null;
1237
+ /** National ID number */
1238
+ idNumber: string | null;
1239
+ /** Free-text notes */
1240
+ notes: string | null;
1241
+ /** Tags for categorization */
1242
+ tags: string[];
1243
+ /** How the guest was acquired */
1244
+ source: string | null;
1245
+ /** Open bag for custom data */
1246
+ metadata: Record<string, unknown> | null;
1247
+ /** Record creation timestamp */
1248
+ createdAt: string;
1249
+ /** Record last-update timestamp */
1250
+ updatedAt: string;
1251
+ /** Soft-delete timestamp, null if active */
1252
+ deletedAt: string | null;
1253
+ }
1254
+ /** Input for creating a new guest */
1255
+ interface CreateGuestInput {
1256
+ /** First name (required) */
1257
+ firstName: string;
1258
+ /** Last name (required) */
1259
+ lastName: string;
1260
+ /** Email address */
1261
+ email?: string;
1262
+ /** Phone number */
1263
+ phone?: string;
1264
+ /** Date of birth in YYYY-MM-DD format */
1265
+ dateOfBirth?: string;
1266
+ /** ISO 3166-1 alpha-2 nationality code */
1267
+ nationality?: string;
1268
+ /** ISO 639-1 language code */
1269
+ language?: string;
1270
+ /** Guest address */
1271
+ address?: GuestAddress;
1272
+ /** Company name */
1273
+ company?: string;
1274
+ /** Passport number */
1275
+ passportNumber?: string;
1276
+ /** National ID number */
1277
+ idNumber?: string;
1278
+ /** Free-text notes */
1279
+ notes?: string;
1280
+ /** Tags for categorization */
1281
+ tags?: string[];
1282
+ /** How the guest was acquired */
1283
+ source?: string;
1284
+ /** Custom metadata */
1285
+ metadata?: Record<string, unknown>;
1286
+ }
1287
+ /** Input for updating an existing guest — all fields optional */
1288
+ interface UpdateGuestInput {
1289
+ /** Update first name */
1290
+ firstName?: string;
1291
+ /** Update last name */
1292
+ lastName?: string;
1293
+ /** Update email */
1294
+ email?: string | null;
1295
+ /** Update phone */
1296
+ phone?: string | null;
1297
+ /** Update date of birth */
1298
+ dateOfBirth?: string | null;
1299
+ /** Update nationality */
1300
+ nationality?: string | null;
1301
+ /** Update language */
1302
+ language?: string | null;
1303
+ /** Update address */
1304
+ address?: GuestAddress | null;
1305
+ /** Update company */
1306
+ company?: string | null;
1307
+ /** Update passport number */
1308
+ passportNumber?: string | null;
1309
+ /** Update ID number */
1310
+ idNumber?: string | null;
1311
+ /** Update notes */
1312
+ notes?: string | null;
1313
+ /** Update tags */
1314
+ tags?: string[];
1315
+ /** Update source */
1316
+ source?: string | null;
1317
+ /** Update metadata */
1318
+ metadata?: Record<string, unknown> | null;
1319
+ }
1320
+ /** Sort configuration for guest list queries */
1321
+ interface GuestSort {
1322
+ /** Field to sort by */
1323
+ field: "firstName" | "lastName" | "email" | "createdAt" | "updatedAt";
1324
+ /** Sort direction */
1325
+ direction: "asc" | "desc";
1326
+ }
1327
+ /** Query parameters for listing guests */
1328
+ interface ListGuestsParams {
1329
+ /** Filter by tags (guests matching any of these tags) */
1330
+ tags?: string[];
1331
+ /** Filter by source */
1332
+ source?: string;
1333
+ /** Filter by creation date (from) */
1334
+ createdFrom?: string;
1335
+ /** Filter by creation date (to) */
1336
+ createdTo?: string;
1337
+ /** Sort configuration */
1338
+ sort?: GuestSort;
1339
+ /** Maximum results per page */
1340
+ limit?: number;
1341
+ /** Pagination cursor */
1342
+ cursor?: string;
1343
+ }
1344
+ /** Paginated list of guests */
1345
+ interface PaginatedGuests {
1346
+ /** Guests in this page */
1347
+ data: Guest[];
1348
+ /** Total number of matching guests */
1349
+ totalCount: number;
1350
+ /** Cursor for next page, null if no more results */
1351
+ cursor: string | null;
1352
+ /** Whether more results are available */
1353
+ hasMore: boolean;
1354
+ }
1355
+ /** Parameters for searching guests */
1356
+ interface SearchGuestsParams {
1357
+ /** Maximum results to return */
1358
+ limit?: number;
1359
+ /** Fields to search in (e.g., ["firstName", "lastName", "email"]) */
1360
+ fields?: string[];
1361
+ }
1362
+ /** A guest match from a search, includes relevance score */
1363
+ interface GuestMatch extends Guest {
1364
+ /** Relevance score between 0 and 1 (1 = exact match) */
1365
+ score: number;
1366
+ }
1367
+ /** Result of a guest search */
1368
+ interface GuestSearchResult {
1369
+ /** Matching guests sorted by score (highest first) */
1370
+ data: GuestMatch[];
1371
+ /** Total number of matches */
1372
+ totalCount: number;
1373
+ }
1374
+ /** A potential duplicate candidate */
1375
+ interface DuplicateCandidate {
1376
+ /** The potential duplicate guest */
1377
+ guest: Guest;
1378
+ /** Confidence score between 0 and 1 (1 = certain duplicate) */
1379
+ confidence: number;
1380
+ /** Fields that matched (e.g., ["email", "phone"]) */
1381
+ matchedFields: string[];
1382
+ }
1383
+ /** Result of duplicate detection */
1384
+ interface GuestDuplicateResult {
1385
+ /** Potential duplicates sorted by confidence (highest first) */
1386
+ data: DuplicateCandidate[];
1387
+ }
1388
+ /** Input for merging duplicate guests into a primary profile */
1389
+ interface MergeGuestsInput {
1390
+ /** IDs of duplicate guests to merge into the primary (required, non-empty) */
1391
+ duplicateIds: string[];
1392
+ }
1393
+ /**
1394
+ * Guest preferences with typed common fields and a custom catch-all.
1395
+ *
1396
+ * Common fields cover typical hospitality preferences.
1397
+ * Use `custom` for vertical-specific or property-specific data.
1398
+ */
1399
+ interface GuestPreferences {
1400
+ /** Preferred room type (e.g., "single", "double", "suite") */
1401
+ roomType: string | null;
1402
+ /** Preferred floor (e.g., "high", "low", "ground") */
1403
+ floorPreference: string | null;
1404
+ /** Preferred bed type (e.g., "king", "twin", "queen") */
1405
+ bedType: string | null;
1406
+ /** Dietary requirements (e.g., "vegetarian", "vegan", "gluten-free") */
1407
+ dietary: string[];
1408
+ /** Known allergies */
1409
+ allergies: string[];
1410
+ /** Preferred communication channel (e.g., "email", "sms", "whatsapp") */
1411
+ communicationChannel: string | null;
1412
+ /** Preferred language for communication */
1413
+ language: string | null;
1414
+ /** Smoking preference */
1415
+ smoking: boolean | null;
1416
+ /** Accessibility requirements */
1417
+ accessibility: string[];
1418
+ /** Free-text special requests */
1419
+ specialRequests: string | null;
1420
+ /** Catch-all for vertical-specific preferences */
1421
+ custom: Record<string, unknown>;
1422
+ }
1423
+ /** Input for updating guest preferences — all fields optional, partial merge */
1424
+ interface UpdateGuestPreferences {
1425
+ /** Update room type preference */
1426
+ roomType?: string | null;
1427
+ /** Update floor preference */
1428
+ floorPreference?: string | null;
1429
+ /** Update bed type preference */
1430
+ bedType?: string | null;
1431
+ /** Update dietary requirements */
1432
+ dietary?: string[];
1433
+ /** Update allergies */
1434
+ allergies?: string[];
1435
+ /** Update communication channel */
1436
+ communicationChannel?: string | null;
1437
+ /** Update language preference */
1438
+ language?: string | null;
1439
+ /** Update smoking preference */
1440
+ smoking?: boolean | null;
1441
+ /** Update accessibility requirements */
1442
+ accessibility?: string[];
1443
+ /** Update special requests */
1444
+ specialRequests?: string | null;
1445
+ /** Update custom preferences (merged, not replaced) */
1446
+ custom?: Record<string, unknown>;
1447
+ }
1448
+ /** Parameters for guest history queries */
1449
+ interface GuestHistoryParams {
1450
+ /** Maximum results per page */
1451
+ limit?: number;
1452
+ /** Pagination cursor */
1453
+ cursor?: string;
1454
+ /** Filter from date in YYYY-MM-DD format */
1455
+ from?: string;
1456
+ /** Filter to date in YYYY-MM-DD format */
1457
+ to?: string;
1458
+ }
1459
+ /** Lightweight booking summary for guest history */
1460
+ interface GuestBookingSummary {
1461
+ /** Booking identifier */
1462
+ id: string;
1463
+ /** Property identifier */
1464
+ propertyId: string;
1465
+ /** Property display name */
1466
+ propertyName: string;
1467
+ /** Booking type */
1468
+ type: BookingType;
1469
+ /** Booking status */
1470
+ status: BookingStatus;
1471
+ /** Check-in date */
1472
+ checkIn: string;
1473
+ /** Check-out date */
1474
+ checkOut: string;
1475
+ /** Total amount in cents */
1476
+ totalAmount: number;
1477
+ /** ISO 4217 currency code */
1478
+ currency: string;
1479
+ }
1480
+ /** Lightweight folio summary for guest history */
1481
+ interface GuestFolioSummary {
1482
+ /** Folio identifier */
1483
+ id: string;
1484
+ /** Associated booking ID */
1485
+ bookingId: string;
1486
+ /** Property identifier */
1487
+ propertyId: string;
1488
+ /** Folio status */
1489
+ status: string;
1490
+ /** Total charges in cents */
1491
+ totalCharges: number;
1492
+ /** Total payments in cents */
1493
+ totalPayments: number;
1494
+ /** Outstanding balance in cents */
1495
+ balance: number;
1496
+ /** ISO 4217 currency code */
1497
+ currency: string;
1498
+ /** When the folio was closed, null if open */
1499
+ closedAt: string | null;
1500
+ }
1501
+ /** Lightweight order summary for guest history */
1502
+ interface GuestOrderSummary {
1503
+ /** Order identifier */
1504
+ id: string;
1505
+ /** Property identifier */
1506
+ propertyId: string;
1507
+ /** Order type */
1508
+ type: string;
1509
+ /** Order status */
1510
+ status: string;
1511
+ /** Total amount in cents */
1512
+ totalAmount: number;
1513
+ /** ISO 4217 currency code */
1514
+ currency: string;
1515
+ /** Number of items in the order */
1516
+ items: number;
1517
+ /** Order creation timestamp */
1518
+ createdAt: string;
1519
+ }
1520
+ /** Paginated list of guest booking summaries */
1521
+ interface PaginatedGuestBookings {
1522
+ /** Booking summaries in this page */
1523
+ data: GuestBookingSummary[];
1524
+ /** Total number of bookings */
1525
+ totalCount: number;
1526
+ /** Cursor for next page, null if no more results */
1527
+ cursor: string | null;
1528
+ /** Whether more results are available */
1529
+ hasMore: boolean;
1530
+ }
1531
+ /** Paginated list of guest folio summaries */
1532
+ interface PaginatedGuestFolios {
1533
+ /** Folio summaries in this page */
1534
+ data: GuestFolioSummary[];
1535
+ /** Total number of folios */
1536
+ totalCount: number;
1537
+ /** Cursor for next page, null if no more results */
1538
+ cursor: string | null;
1539
+ /** Whether more results are available */
1540
+ hasMore: boolean;
1541
+ }
1542
+ /** Paginated list of guest order summaries */
1543
+ interface PaginatedGuestOrders {
1544
+ /** Order summaries in this page */
1545
+ data: GuestOrderSummary[];
1546
+ /** Total number of orders */
1547
+ totalCount: number;
1548
+ /** Cursor for next page, null if no more results */
1549
+ cursor: string | null;
1550
+ /** Whether more results are available */
1551
+ hasMore: boolean;
1552
+ }
1553
+
1554
+ /**
1555
+ * Service for managing guest profiles in the Atzentis Booking API.
1556
+ *
1557
+ * Provides full CRUD, search with scoring, duplicate detection,
1558
+ * profile merging, preferences management, and cross-domain history
1559
+ * (bookings, folios, orders).
1560
+ *
1561
+ * @example
1562
+ * ```typescript
1563
+ * const booking = new BookingClient({ apiKey: "atz_io_live_xxxxx" });
1564
+ *
1565
+ * // Create a guest
1566
+ * const guest = await booking.guests.create({
1567
+ * firstName: "John",
1568
+ * lastName: "Doe",
1569
+ * email: "john@example.com",
1570
+ * });
1571
+ *
1572
+ * // Search for guests
1573
+ * const results = await booking.guests.search("Doe");
1574
+ *
1575
+ * // Get booking history
1576
+ * const history = await booking.guests.getBookings(guest.id);
1577
+ * ```
1578
+ */
1579
+ declare class GuestsService extends BaseService {
1580
+ protected readonly basePath = "/guest/v1/profiles";
1581
+ /**
1582
+ * Create a new guest profile.
1583
+ *
1584
+ * @example
1585
+ * ```typescript
1586
+ * const guest = await client.guests.create({
1587
+ * firstName: "Maria",
1588
+ * lastName: "Papadopoulou",
1589
+ * email: "maria@example.com",
1590
+ * phone: "+30 210 1234567",
1591
+ * nationality: "GR",
1592
+ * });
1593
+ * ```
1594
+ */
1595
+ create(input: CreateGuestInput): Promise<Guest>;
1596
+ /**
1597
+ * Get a single guest by ID.
1598
+ *
1599
+ * @example
1600
+ * ```typescript
1601
+ * const guest = await client.guests.get("guest_42");
1602
+ * ```
1603
+ */
1604
+ get(guestId: string): Promise<Guest>;
1605
+ /**
1606
+ * List guests with optional filters and cursor-based pagination.
1607
+ *
1608
+ * @example
1609
+ * ```typescript
1610
+ * const page = await client.guests.list({
1611
+ * tags: ["vip", "returning"],
1612
+ * sort: { field: "lastName", direction: "asc" },
1613
+ * limit: 20,
1614
+ * });
1615
+ * ```
1616
+ */
1617
+ list(params?: ListGuestsParams): Promise<PaginatedGuests>;
1618
+ /**
1619
+ * Update an existing guest profile.
1620
+ *
1621
+ * @example
1622
+ * ```typescript
1623
+ * const updated = await client.guests.update("guest_42", {
1624
+ * email: "maria.new@example.com",
1625
+ * tags: ["vip"],
1626
+ * });
1627
+ * ```
1628
+ */
1629
+ update(guestId: string, input: UpdateGuestInput): Promise<Guest>;
1630
+ /**
1631
+ * Delete a guest profile (soft-delete).
1632
+ *
1633
+ * @example
1634
+ * ```typescript
1635
+ * await client.guests.delete("guest_42");
1636
+ * ```
1637
+ */
1638
+ delete(guestId: string): Promise<void>;
1639
+ /**
1640
+ * Search guests by name, email, phone, or passport number.
1641
+ *
1642
+ * Returns results sorted by relevance score (highest first).
1643
+ *
1644
+ * @param query - Search query string
1645
+ * @param params - Optional search parameters (limit, fields)
1646
+ *
1647
+ * @example
1648
+ * ```typescript
1649
+ * // Search by name
1650
+ * const results = await client.guests.search("Papadopoulos");
1651
+ *
1652
+ * // Search by email with field filter
1653
+ * const results2 = await client.guests.search("maria@", {
1654
+ * fields: ["email"],
1655
+ * limit: 5,
1656
+ * });
1657
+ * ```
1658
+ */
1659
+ search(query: string, params?: SearchGuestsParams): Promise<GuestSearchResult>;
1660
+ /**
1661
+ * Find potential duplicate profiles for a guest.
1662
+ *
1663
+ * Returns candidates sorted by confidence score (highest first).
1664
+ *
1665
+ * @throws {NotFoundError} 404 if the guest is not found
1666
+ *
1667
+ * @example
1668
+ * ```typescript
1669
+ * const duplicates = await client.guests.findDuplicates("guest_42");
1670
+ * for (const dup of duplicates.data) {
1671
+ * console.log(`${dup.guest.firstName} — ${dup.confidence} (${dup.matchedFields})`);
1672
+ * }
1673
+ * ```
1674
+ */
1675
+ findDuplicates(guestId: string): Promise<GuestDuplicateResult>;
1676
+ /**
1677
+ * Merge duplicate guest profiles into a primary profile.
1678
+ *
1679
+ * **Warning: This operation is irreversible.** All history from duplicate
1680
+ * profiles is transferred to the primary. Duplicate profiles are soft-deleted.
1681
+ *
1682
+ * @throws {NotFoundError} 404 if primary or any duplicate is not found
1683
+ * @throws {ConflictError} 409 if attempting to merge a guest into itself
1684
+ * @throws {ValidationError} 400 if duplicateIds is empty
1685
+ *
1686
+ * @example
1687
+ * ```typescript
1688
+ * const merged = await client.guests.merge("guest_primary", {
1689
+ * duplicateIds: ["guest_dup1", "guest_dup2"],
1690
+ * });
1691
+ * ```
1692
+ */
1693
+ merge(primaryId: string, input: MergeGuestsInput): Promise<Guest>;
1694
+ /**
1695
+ * Get guest preferences.
1696
+ *
1697
+ * Returns default/empty preferences if none have been set (does not throw 404).
1698
+ *
1699
+ * @throws {NotFoundError} 404 if the guest is not found
1700
+ *
1701
+ * @example
1702
+ * ```typescript
1703
+ * const prefs = await client.guests.getPreferences("guest_42");
1704
+ * console.log(prefs.dietary, prefs.roomType);
1705
+ * ```
1706
+ */
1707
+ getPreferences(guestId: string): Promise<GuestPreferences>;
1708
+ /**
1709
+ * Update guest preferences (partial merge).
1710
+ *
1711
+ * Only provided fields are updated; unspecified fields retain their values.
1712
+ *
1713
+ * @throws {NotFoundError} 404 if the guest is not found
1714
+ *
1715
+ * @example
1716
+ * ```typescript
1717
+ * const updated = await client.guests.updatePreferences("guest_42", {
1718
+ * dietary: ["vegetarian"],
1719
+ * roomType: "suite",
1720
+ * custom: { pillow: "firm" },
1721
+ * });
1722
+ * ```
1723
+ */
1724
+ updatePreferences(guestId: string, input: UpdateGuestPreferences): Promise<GuestPreferences>;
1725
+ /**
1726
+ * Get a guest's booking history.
1727
+ *
1728
+ * Returns lightweight booking summaries with pagination support.
1729
+ *
1730
+ * @throws {NotFoundError} 404 if the guest is not found
1731
+ *
1732
+ * @example
1733
+ * ```typescript
1734
+ * const bookings = await client.guests.getBookings("guest_42", {
1735
+ * from: "2025-01-01",
1736
+ * to: "2025-12-31",
1737
+ * limit: 10,
1738
+ * });
1739
+ * ```
1740
+ */
1741
+ getBookings(guestId: string, params?: GuestHistoryParams): Promise<PaginatedGuestBookings>;
1742
+ /**
1743
+ * Get a guest's folio history.
1744
+ *
1745
+ * Returns lightweight folio summaries with pagination support.
1746
+ *
1747
+ * @throws {NotFoundError} 404 if the guest is not found
1748
+ *
1749
+ * @example
1750
+ * ```typescript
1751
+ * const folios = await client.guests.getFolios("guest_42");
1752
+ * ```
1753
+ */
1754
+ getFolios(guestId: string, params?: GuestHistoryParams): Promise<PaginatedGuestFolios>;
1755
+ /**
1756
+ * Get a guest's order history.
1757
+ *
1758
+ * Returns lightweight order summaries with pagination support.
1759
+ *
1760
+ * @throws {NotFoundError} 404 if the guest is not found
1761
+ *
1762
+ * @example
1763
+ * ```typescript
1764
+ * const orders = await client.guests.getOrders("guest_42", {
1765
+ * limit: 5,
1766
+ * cursor: "next_page",
1767
+ * });
1768
+ * ```
1769
+ */
1770
+ getOrders(guestId: string, params?: GuestHistoryParams): Promise<PaginatedGuestOrders>;
1771
+ /** Build query params from GuestHistoryParams, omitting undefined values */
1772
+ private _buildHistoryQuery;
1773
+ }
1774
+
728
1775
  /**
729
1776
  * Service for managing properties in the Atzentis Booking API.
730
1777
  *
@@ -945,12 +1992,18 @@ declare class SpacesService extends BaseService {
945
1992
  declare class BookingClient {
946
1993
  readonly httpClient: HttpClient;
947
1994
  private _availability?;
1995
+ private _bookings?;
1996
+ private _guests?;
948
1997
  private _properties?;
949
1998
  private _categories?;
950
1999
  private _spaces?;
951
2000
  constructor(config: BookingClientConfig);
952
2001
  /** Availability service — lazy-initialized on first access */
953
2002
  get availability(): AvailabilityService;
2003
+ /** Bookings service — lazy-initialized on first access */
2004
+ get bookings(): BookingsService;
2005
+ /** Guests service — lazy-initialized on first access */
2006
+ get guests(): GuestsService;
954
2007
  /** Properties service — lazy-initialized on first access */
955
2008
  get properties(): PropertiesService;
956
2009
  /** Categories service — lazy-initialized on first access */
@@ -1039,4 +2092,4 @@ declare function firstPage<T>(fetcher: PageFetcher<T>, options?: PaginationOptio
1039
2092
 
1040
2093
  declare const VERSION = "0.1.0";
1041
2094
 
1042
- export { AuthenticationError, type AvailabilityCheckParams, type AvailabilityPricing, type AvailabilityRestrictions, type AvailabilityResult, type AvailabilitySearchParams, type AvailabilitySearchResult, type AvailabilitySearchResultEntry, AvailabilityService, type AvailableSpace, BookingClient, type BookingClientConfig, BookingError, type BookingErrorOptions, type BulkUpdateSpaceInput, type CalendarDay, type CalendarParams, CategoriesService, ConflictError, type Coordinates, type CreateCategoryInput, type CreatePropertyInput, type CreateSpaceInput, DEFAULT_MODULES, ForbiddenError, HttpClient, type HttpClientOptions, type HttpMethod, type HttpResponse, type LinkPosTableInput, type ListCategoriesParams, type ListPropertiesParams, type ListSpacesParams, type Logger, NotFoundError, PROPERTY_MODULES, type PageFetcher, type Paginated, type PaginationOptions, PaymentError, type PriceRange, type PricingParams, type PricingResult, PropertiesService, type Property, type PropertyAddress, type PropertyModules, type PropertyStatus, type PropertyType, RateLimitError, type RequestOptions, type ResolvedBookingClientConfig, type RetryConfig, type RetryOptions, SPACE_STATUSES, SPACE_TYPES, ServerError, type ServiceSlotParams, type ServiceTimeSlot, type Space, type SpaceCategory, type SpaceStatus, type SpaceType, SpacesService, type TableSlotParams, type TimeSlot, TimeoutError, type UpdateCategoryInput, type UpdatePropertyInput, type UpdateSpaceInput, VERSION, ValidationError, bookingClientConfigSchema, createErrorFromResponse, firstPage, paginate };
2095
+ export { type AssignSpaceInput, AuthenticationError, type AvailabilityCheckParams, type AvailabilityPricing, type AvailabilityRestrictions, type AvailabilityResult, type AvailabilitySearchParams, type AvailabilitySearchResult, type AvailabilitySearchResultEntry, AvailabilityService, type AvailableSpace, BOOKING_STATUSES, BOOKING_TYPES, type Booking, BookingClient, type BookingClientConfig, BookingError, type BookingErrorOptions, type BookingGuest, type BookingPricing, type BookingSort, type BookingSpace, type BookingStatus, type BookingType, BookingsService, type BulkUpdateSpaceInput, type CalendarDay, type CalendarParams, type CancelBookingInput, CategoriesService, type CheckInInput, type CheckOutInput, ConflictError, type Coordinates, type CreateBookingInput, type CreateCategoryInput, type CreateGuestInput, type CreatePropertyInput, type CreateSpaceInput, DEFAULT_MODULES, type DuplicateCandidate, ForbiddenError, type Guest, type GuestAddress, type GuestBookingSummary, type GuestDuplicateResult, type GuestFolioSummary, type GuestHistoryParams, type GuestMatch, type GuestOrderSummary, type GuestPreferences, type GuestSearchResult, type GuestSort, GuestsService, HttpClient, type HttpClientOptions, type HttpMethod, type HttpResponse, type LinkPosTableInput, type ListBookingsParams, type ListCategoriesParams, type ListGuestsParams, type ListPropertiesParams, type ListSpacesParams, type Logger, type MergeGuestsInput, type NoShowInput, NotFoundError, PROPERTY_MODULES, type PageFetcher, type Paginated, type PaginatedBookings, type PaginatedGuestBookings, type PaginatedGuestFolios, type PaginatedGuestOrders, type PaginatedGuests, type PaginationOptions, PaymentError, type PriceRange, type PricingParams, type PricingResult, PropertiesService, type Property, type PropertyAddress, type PropertyModules, type PropertyStatus, type PropertyType, RateLimitError, type RequestOptions, type ResolvedBookingClientConfig, type RetryConfig, type RetryOptions, SPACE_STATUSES, SPACE_TYPES, type SearchGuestsParams, ServerError, type ServiceSlotParams, type ServiceTimeSlot, type Space, type SpaceCategory, type SpaceStatus, type SpaceType, SpacesService, type TableSlotParams, type TimeSlot, TimeoutError, type UpdateBookingInput, type UpdateCategoryInput, type UpdateGuestInput, type UpdateGuestPreferences, type UpdatePropertyInput, type UpdateSpaceInput, VERSION, ValidationError, bookingClientConfigSchema, createErrorFromResponse, firstPage, paginate };