@livex/contracts 0.1.0

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.
@@ -0,0 +1,1277 @@
1
+ import { AnySchema } from 'ajv';
2
+ export { validateBookingConfirmed, validateWebhookPaymentReceived, validators } from './validators.cjs';
3
+
4
+ var openapi = "3.1.0";
5
+ var info = {
6
+ title: "LIVEX API",
7
+ version: "1.0.0",
8
+ description: "Contratos v1 del MVP: catálogo, disponibilidad, bookings y webhooks de pago.",
9
+ license: {
10
+ name: "MIT",
11
+ url: "https://opensource.org/licenses/MIT"
12
+ }
13
+ };
14
+ var servers = [
15
+ {
16
+ url: "https://api.livex.app/v1"
17
+ }
18
+ ];
19
+ var security = [
20
+ {
21
+ BearerAuth: [
22
+ ]
23
+ }
24
+ ];
25
+ var paths = {
26
+ "/experiences": {
27
+ get: {
28
+ summary: "Listar experiencias",
29
+ operationId: "listExperiences",
30
+ security: [
31
+ ],
32
+ parameters: [
33
+ {
34
+ name: "q",
35
+ "in": "query",
36
+ schema: {
37
+ type: "string"
38
+ }
39
+ },
40
+ {
41
+ name: "categoryId",
42
+ "in": "query",
43
+ schema: {
44
+ type: "string",
45
+ format: "uuid"
46
+ }
47
+ },
48
+ {
49
+ name: "limit",
50
+ "in": "query",
51
+ schema: {
52
+ type: "integer",
53
+ minimum: 1,
54
+ maximum: 100,
55
+ "default": 20
56
+ }
57
+ },
58
+ {
59
+ name: "offset",
60
+ "in": "query",
61
+ schema: {
62
+ type: "integer",
63
+ minimum: 0,
64
+ "default": 0
65
+ }
66
+ }
67
+ ],
68
+ responses: {
69
+ "200": {
70
+ description: "OK",
71
+ content: {
72
+ "application/json": {
73
+ schema: {
74
+ type: "object",
75
+ properties: {
76
+ items: {
77
+ type: "array",
78
+ items: {
79
+ $ref: "#/components/schemas/ExperienceSummary"
80
+ }
81
+ },
82
+ total: {
83
+ type: "integer"
84
+ }
85
+ },
86
+ required: [
87
+ "items",
88
+ "total"
89
+ ]
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "400": {
95
+ $ref: "#/components/responses/BadRequest"
96
+ }
97
+ }
98
+ }
99
+ },
100
+ "/experiences/{experienceId}": {
101
+ get: {
102
+ summary: "Detalle de experiencia",
103
+ operationId: "getExperience",
104
+ security: [
105
+ ],
106
+ parameters: [
107
+ {
108
+ name: "experienceId",
109
+ "in": "path",
110
+ required: true,
111
+ schema: {
112
+ type: "string",
113
+ format: "uuid"
114
+ }
115
+ }
116
+ ],
117
+ responses: {
118
+ "200": {
119
+ description: "OK",
120
+ content: {
121
+ "application/json": {
122
+ schema: {
123
+ $ref: "#/components/schemas/Experience"
124
+ }
125
+ }
126
+ }
127
+ },
128
+ "400": {
129
+ $ref: "#/components/responses/BadRequest"
130
+ },
131
+ "404": {
132
+ $ref: "#/components/responses/NotFound"
133
+ }
134
+ }
135
+ }
136
+ },
137
+ "/availability": {
138
+ get: {
139
+ summary: "Consultar disponibilidad por experiencia y fecha",
140
+ operationId: "getAvailability",
141
+ security: [
142
+ ],
143
+ parameters: [
144
+ {
145
+ name: "experienceId",
146
+ "in": "query",
147
+ required: true,
148
+ schema: {
149
+ type: "string",
150
+ format: "uuid"
151
+ }
152
+ },
153
+ {
154
+ name: "date",
155
+ "in": "query",
156
+ required: true,
157
+ schema: {
158
+ type: "string",
159
+ format: "date"
160
+ }
161
+ }
162
+ ],
163
+ responses: {
164
+ "200": {
165
+ description: "OK",
166
+ content: {
167
+ "application/json": {
168
+ schema: {
169
+ type: "array",
170
+ items: {
171
+ $ref: "#/components/schemas/AvailabilitySlot"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ },
177
+ "400": {
178
+ $ref: "#/components/responses/BadRequest"
179
+ }
180
+ }
181
+ }
182
+ },
183
+ "/bookings": {
184
+ post: {
185
+ summary: "Crear booking (pending + lock de inventario)",
186
+ operationId: "createBooking",
187
+ parameters: [
188
+ {
189
+ name: "Idempotency-Key",
190
+ "in": "header",
191
+ required: true,
192
+ description: "Requerido para evitar duplicados en creación.",
193
+ schema: {
194
+ type: "string",
195
+ maxLength: 128
196
+ }
197
+ }
198
+ ],
199
+ requestBody: {
200
+ required: true,
201
+ content: {
202
+ "application/json": {
203
+ schema: {
204
+ $ref: "#/components/schemas/CreateBookingInput"
205
+ }
206
+ }
207
+ }
208
+ },
209
+ responses: {
210
+ "201": {
211
+ description: "Creado",
212
+ headers: {
213
+ Location: {
214
+ schema: {
215
+ type: "string"
216
+ },
217
+ description: "URL del booking creado."
218
+ }
219
+ },
220
+ content: {
221
+ "application/json": {
222
+ schema: {
223
+ $ref: "#/components/schemas/Booking"
224
+ }
225
+ }
226
+ }
227
+ },
228
+ "400": {
229
+ $ref: "#/components/responses/BadRequest"
230
+ },
231
+ "409": {
232
+ $ref: "#/components/responses/Conflict"
233
+ },
234
+ "422": {
235
+ $ref: "#/components/responses/UnprocessableEntity"
236
+ }
237
+ }
238
+ }
239
+ },
240
+ "/bookings/{bookingId}": {
241
+ get: {
242
+ summary: "Obtener booking por ID",
243
+ operationId: "getBooking",
244
+ parameters: [
245
+ {
246
+ name: "bookingId",
247
+ "in": "path",
248
+ required: true,
249
+ schema: {
250
+ type: "string",
251
+ format: "uuid"
252
+ }
253
+ }
254
+ ],
255
+ responses: {
256
+ "200": {
257
+ description: "OK",
258
+ content: {
259
+ "application/json": {
260
+ schema: {
261
+ $ref: "#/components/schemas/Booking"
262
+ }
263
+ }
264
+ }
265
+ },
266
+ "400": {
267
+ $ref: "#/components/responses/BadRequest"
268
+ },
269
+ "404": {
270
+ $ref: "#/components/responses/NotFound"
271
+ }
272
+ }
273
+ }
274
+ },
275
+ "/webhooks/payments/{provider}": {
276
+ post: {
277
+ summary: "Webhook de pagos (firma validada por API)",
278
+ operationId: "paymentsWebhook",
279
+ security: [
280
+ ],
281
+ parameters: [
282
+ {
283
+ name: "provider",
284
+ "in": "path",
285
+ required: true,
286
+ schema: {
287
+ type: "string",
288
+ "enum": [
289
+ "wompi",
290
+ "epayco",
291
+ "other"
292
+ ]
293
+ }
294
+ }
295
+ ],
296
+ requestBody: {
297
+ required: true,
298
+ content: {
299
+ "application/json": {
300
+ schema: {
301
+ $ref: "#/components/schemas/PaymentWebhookPayload"
302
+ }
303
+ }
304
+ }
305
+ },
306
+ responses: {
307
+ "202": {
308
+ description: "Aceptado para procesamiento asíncrono"
309
+ },
310
+ "400": {
311
+ $ref: "#/components/responses/BadRequest"
312
+ },
313
+ "401": {
314
+ $ref: "#/components/responses/Unauthorized"
315
+ }
316
+ }
317
+ }
318
+ }
319
+ };
320
+ var components = {
321
+ securitySchemes: {
322
+ BearerAuth: {
323
+ type: "http",
324
+ scheme: "bearer",
325
+ bearerFormat: "JWT"
326
+ }
327
+ },
328
+ schemas: {
329
+ UUID: {
330
+ type: "string",
331
+ format: "uuid"
332
+ },
333
+ Money: {
334
+ type: "object",
335
+ properties: {
336
+ amount: {
337
+ type: "integer",
338
+ minimum: 0,
339
+ description: "Centavos"
340
+ },
341
+ currency: {
342
+ type: "string",
343
+ minLength: 3,
344
+ maxLength: 3,
345
+ example: "COP"
346
+ }
347
+ },
348
+ required: [
349
+ "amount",
350
+ "currency"
351
+ ],
352
+ additionalProperties: false
353
+ },
354
+ ExperienceSummary: {
355
+ type: "object",
356
+ properties: {
357
+ id: {
358
+ $ref: "#/components/schemas/UUID"
359
+ },
360
+ title: {
361
+ type: "string"
362
+ },
363
+ coverImageUrl: {
364
+ type: "string",
365
+ format: "uri"
366
+ },
367
+ city: {
368
+ type: "string"
369
+ },
370
+ country: {
371
+ type: "string"
372
+ },
373
+ ratingAvg: {
374
+ type: "number",
375
+ minimum: 0,
376
+ maximum: 5
377
+ },
378
+ ratingCount: {
379
+ type: "integer",
380
+ minimum: 0
381
+ },
382
+ fromPrice: {
383
+ $ref: "#/components/schemas/Money"
384
+ }
385
+ },
386
+ required: [
387
+ "id",
388
+ "title",
389
+ "fromPrice"
390
+ ]
391
+ },
392
+ Experience: {
393
+ allOf: [
394
+ {
395
+ $ref: "#/components/schemas/ExperienceSummary"
396
+ },
397
+ {
398
+ type: "object",
399
+ properties: {
400
+ description: {
401
+ type: "string"
402
+ },
403
+ includes: {
404
+ type: "array",
405
+ items: {
406
+ type: "string"
407
+ }
408
+ },
409
+ notIncludes: {
410
+ type: "array",
411
+ items: {
412
+ type: "string"
413
+ }
414
+ },
415
+ images: {
416
+ type: "array",
417
+ items: {
418
+ type: "string",
419
+ format: "uri"
420
+ }
421
+ },
422
+ status: {
423
+ type: "string",
424
+ "enum": [
425
+ "draft",
426
+ "under_review",
427
+ "active",
428
+ "rejected"
429
+ ]
430
+ }
431
+ },
432
+ required: [
433
+ "status"
434
+ ]
435
+ }
436
+ ]
437
+ },
438
+ AvailabilitySlot: {
439
+ type: "object",
440
+ properties: {
441
+ slotId: {
442
+ $ref: "#/components/schemas/UUID"
443
+ },
444
+ start: {
445
+ type: "string",
446
+ format: "date-time"
447
+ },
448
+ end: {
449
+ type: "string",
450
+ format: "date-time"
451
+ },
452
+ capacity: {
453
+ type: "integer",
454
+ minimum: 1
455
+ },
456
+ remaining: {
457
+ type: "integer",
458
+ minimum: 0
459
+ },
460
+ price: {
461
+ $ref: "#/components/schemas/Money"
462
+ }
463
+ },
464
+ required: [
465
+ "slotId",
466
+ "start",
467
+ "end",
468
+ "capacity",
469
+ "remaining",
470
+ "price"
471
+ ]
472
+ },
473
+ CreateBookingInput: {
474
+ type: "object",
475
+ properties: {
476
+ experienceId: {
477
+ $ref: "#/components/schemas/UUID"
478
+ },
479
+ slotId: {
480
+ $ref: "#/components/schemas/UUID"
481
+ },
482
+ quantity: {
483
+ type: "integer",
484
+ minimum: 1
485
+ },
486
+ buyer: {
487
+ type: "object",
488
+ properties: {
489
+ fullName: {
490
+ type: "string"
491
+ },
492
+ email: {
493
+ type: "string",
494
+ format: "email"
495
+ },
496
+ phone: {
497
+ type: "string"
498
+ }
499
+ },
500
+ required: [
501
+ "fullName",
502
+ "email"
503
+ ]
504
+ },
505
+ payment: {
506
+ type: "object",
507
+ properties: {
508
+ method: {
509
+ type: "string",
510
+ "enum": [
511
+ "card",
512
+ "pse",
513
+ "cash",
514
+ "other"
515
+ ]
516
+ },
517
+ provider: {
518
+ type: "string",
519
+ "enum": [
520
+ "wompi",
521
+ "epayco",
522
+ "other"
523
+ ]
524
+ }
525
+ },
526
+ required: [
527
+ "method",
528
+ "provider"
529
+ ]
530
+ }
531
+ },
532
+ required: [
533
+ "experienceId",
534
+ "slotId",
535
+ "quantity",
536
+ "buyer",
537
+ "payment"
538
+ ],
539
+ additionalProperties: false
540
+ },
541
+ Booking: {
542
+ type: "object",
543
+ properties: {
544
+ id: {
545
+ $ref: "#/components/schemas/UUID"
546
+ },
547
+ status: {
548
+ type: "string",
549
+ "enum": [
550
+ "pending",
551
+ "confirmed",
552
+ "completed",
553
+ "cancelled",
554
+ "refunded",
555
+ "expired"
556
+ ]
557
+ },
558
+ experienceId: {
559
+ $ref: "#/components/schemas/UUID"
560
+ },
561
+ slotId: {
562
+ $ref: "#/components/schemas/UUID"
563
+ },
564
+ quantity: {
565
+ type: "integer",
566
+ minimum: 1
567
+ },
568
+ total: {
569
+ $ref: "#/components/schemas/Money"
570
+ },
571
+ createdAt: {
572
+ type: "string",
573
+ format: "date-time"
574
+ }
575
+ },
576
+ required: [
577
+ "id",
578
+ "status",
579
+ "experienceId",
580
+ "slotId",
581
+ "quantity",
582
+ "total",
583
+ "createdAt"
584
+ ]
585
+ },
586
+ PaymentWebhookPayload: {
587
+ type: "object",
588
+ properties: {
589
+ event: {
590
+ type: "string",
591
+ example: "transaction.updated"
592
+ },
593
+ data: {
594
+ type: "object",
595
+ properties: {
596
+ providerRef: {
597
+ type: "string"
598
+ },
599
+ status: {
600
+ type: "string",
601
+ "enum": [
602
+ "APPROVED",
603
+ "DECLINED",
604
+ "VOIDED",
605
+ "ERROR",
606
+ "PENDING"
607
+ ]
608
+ },
609
+ amountInCents: {
610
+ type: "integer",
611
+ minimum: 0
612
+ },
613
+ currency: {
614
+ type: "string",
615
+ minLength: 3,
616
+ maxLength: 3
617
+ },
618
+ bookingId: {
619
+ type: "string",
620
+ format: "uuid",
621
+ description: "Opcional si el flujo incluye referencia directa al booking."
622
+ }
623
+ },
624
+ required: [
625
+ "providerRef",
626
+ "status",
627
+ "amountInCents",
628
+ "currency"
629
+ ]
630
+ },
631
+ sentAt: {
632
+ type: "string",
633
+ format: "date-time"
634
+ }
635
+ },
636
+ required: [
637
+ "event",
638
+ "data"
639
+ ]
640
+ },
641
+ "Error": {
642
+ type: "object",
643
+ properties: {
644
+ error_code: {
645
+ type: "string"
646
+ },
647
+ message: {
648
+ type: "string"
649
+ },
650
+ details: {
651
+ type: [
652
+ "object",
653
+ "null"
654
+ ]
655
+ }
656
+ },
657
+ required: [
658
+ "error_code",
659
+ "message"
660
+ ]
661
+ }
662
+ },
663
+ responses: {
664
+ BadRequest: {
665
+ description: "Solicitud inválida",
666
+ content: {
667
+ "application/json": {
668
+ schema: {
669
+ $ref: "#/components/schemas/Error"
670
+ }
671
+ }
672
+ }
673
+ },
674
+ Unauthorized: {
675
+ description: "No autorizado"
676
+ },
677
+ NotFound: {
678
+ description: "No encontrado",
679
+ content: {
680
+ "application/json": {
681
+ schema: {
682
+ $ref: "#/components/schemas/Error"
683
+ }
684
+ }
685
+ }
686
+ },
687
+ Conflict: {
688
+ description: "Conflicto (idempotencia, duplicado, etc.)",
689
+ content: {
690
+ "application/json": {
691
+ schema: {
692
+ $ref: "#/components/schemas/Error"
693
+ }
694
+ }
695
+ }
696
+ },
697
+ UnprocessableEntity: {
698
+ description: "Validación fallida",
699
+ content: {
700
+ "application/json": {
701
+ schema: {
702
+ $ref: "#/components/schemas/Error"
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ };
709
+ var livex_v1 = {
710
+ openapi: openapi,
711
+ info: info,
712
+ servers: servers,
713
+ security: security,
714
+ paths: paths,
715
+ components: components
716
+ };
717
+
718
+ type UUID$1 = string;
719
+ interface Money {
720
+ amount: number;
721
+ currency: string;
722
+ }
723
+ interface ExperienceSummary {
724
+ id: UUID$1;
725
+ title: string;
726
+ coverImageUrl?: string;
727
+ city?: string;
728
+ country?: string;
729
+ ratingAvg?: number;
730
+ ratingCount?: number;
731
+ fromPrice: Money;
732
+ }
733
+ type ExperienceStatus$1 = 'draft' | 'under_review' | 'active' | 'rejected';
734
+ interface Experience extends ExperienceSummary {
735
+ description?: string;
736
+ includes?: string[];
737
+ notIncludes?: string[];
738
+ images?: string[];
739
+ status: ExperienceStatus$1;
740
+ }
741
+ interface AvailabilitySlot {
742
+ slotId: UUID$1;
743
+ start: string;
744
+ end: string;
745
+ capacity: number;
746
+ remaining: number;
747
+ price: Money;
748
+ }
749
+ type PaymentMethod = 'card' | 'pse' | 'cash' | 'other';
750
+ type PaymentProvider = 'wompi' | 'epayco' | 'other';
751
+ interface CreateBookingInput {
752
+ experienceId: UUID$1;
753
+ slotId: UUID$1;
754
+ quantity: number;
755
+ buyer: {
756
+ fullName: string;
757
+ email: string;
758
+ phone?: string;
759
+ };
760
+ payment: {
761
+ method: PaymentMethod;
762
+ provider: PaymentProvider;
763
+ };
764
+ }
765
+ type BookingStatus$1 = 'pending' | 'confirmed' | 'completed' | 'cancelled' | 'refunded' | 'expired';
766
+ interface Booking {
767
+ id: UUID$1;
768
+ status: BookingStatus$1;
769
+ experienceId: UUID$1;
770
+ slotId: UUID$1;
771
+ quantity: number;
772
+ total: Money;
773
+ createdAt: string;
774
+ }
775
+ interface PaymentWebhookPayload {
776
+ event: string;
777
+ data: {
778
+ providerRef: string;
779
+ status: 'APPROVED' | 'DECLINED' | 'VOIDED' | 'ERROR' | 'PENDING';
780
+ amountInCents: number;
781
+ currency: string;
782
+ bookingId?: UUID$1;
783
+ };
784
+ sentAt?: string;
785
+ }
786
+ interface BookingConfirmedEvent {
787
+ eventType: 'booking.confirmed';
788
+ eventId: UUID$1;
789
+ occurredAt: string;
790
+ booking: {
791
+ id: UUID$1;
792
+ experienceId: UUID$1;
793
+ slotId: UUID$1;
794
+ quantity: number;
795
+ totalInCents: number;
796
+ currency: string;
797
+ };
798
+ payment: {
799
+ provider: string;
800
+ providerRef: string;
801
+ };
802
+ request_id?: string;
803
+ }
804
+ interface WebhookPaymentReceivedEvent {
805
+ eventType: 'webhook.payment.received';
806
+ eventId: UUID$1;
807
+ provider: PaymentProvider;
808
+ provider_event_id: string;
809
+ payload: Record<string, unknown>;
810
+ receivedAt: string;
811
+ }
812
+
813
+ /**
814
+ * Tipos de base de datos (PostgreSQL) derivados del DDL de LIVEX.
815
+ * Convención: *Row usa snake_case para mapear 1:1 a columnas SQL.
816
+ * También se exponen *Insert y *Update para conveniencia en repos/DAOs.
817
+ */
818
+ type UserRole = 'tourist' | 'resort' | 'admin';
819
+ type ExperienceStatus = 'draft' | 'under_review' | 'active' | 'rejected';
820
+ type BookingStatus = 'pending' | 'confirmed' | 'cancelled' | 'refunded' | 'expired';
821
+ type PaymentStatus = 'authorized' | 'paid' | 'refunded' | 'failed';
822
+ type ResortStatus = 'draft' | 'under_review' | 'approved' | 'rejected';
823
+ type CommissionStatus = 'accrued' | 'in_payout' | 'paid' | 'void';
824
+ type PayoutStatus = 'draft' | 'processing' | 'paid' | 'failed';
825
+ type DocumentStatus = 'uploaded' | 'under_review' | 'approved' | 'rejected';
826
+ type ResortDocType = 'national_id' | 'tax_id' | 'license' | 'insurance' | 'bank_cert' | 'other';
827
+ type WebhookStatus = 'pending' | 'processed' | 'failed' | 'ignored';
828
+ type OutboxStatus = 'pending' | 'sent' | 'failed';
829
+ type UUID = string;
830
+ type Inet = string;
831
+ type Json = unknown;
832
+ interface UsersRow {
833
+ id: UUID;
834
+ email: string;
835
+ full_name: string | null;
836
+ role: UserRole;
837
+ created_at: string;
838
+ updated_at: string;
839
+ }
840
+ type UsersInsert = Omit<UsersRow, 'id' | 'created_at' | 'updated_at' | 'role'> & {
841
+ role?: UserRole;
842
+ };
843
+ type UsersUpdate = Partial<UsersRow>;
844
+ interface ResortsRow {
845
+ id: UUID;
846
+ name: string;
847
+ description: string | null;
848
+ contact_email: string | null;
849
+ contact_phone: string | null;
850
+ address_line: string | null;
851
+ city: string | null;
852
+ country: string | null;
853
+ latitude: number | null;
854
+ longitude: number | null;
855
+ owner_user_id: UUID | null;
856
+ is_active: boolean;
857
+ status: ResortStatus;
858
+ approved_by: UUID | null;
859
+ approved_at: string | null;
860
+ rejection_reason: string | null;
861
+ created_at: string;
862
+ updated_at: string;
863
+ }
864
+ type ResortsInsert = Omit<ResortsRow, 'id' | 'status' | 'is_active' | 'created_at' | 'updated_at'> & {
865
+ is_active?: boolean;
866
+ status?: ResortStatus;
867
+ };
868
+ type ResortsUpdate = Partial<ResortsRow>;
869
+ interface ExperiencesRow {
870
+ id: UUID;
871
+ resort_id: UUID;
872
+ title: string;
873
+ slug: string;
874
+ description: string | null;
875
+ category: 'islands' | 'nautical' | 'city_tour';
876
+ price_cents: number;
877
+ currency: string;
878
+ includes: string | null;
879
+ excludes: string | null;
880
+ main_image_url: string | null;
881
+ status: ExperienceStatus;
882
+ rating_avg: number;
883
+ rating_count: number;
884
+ approved_by: UUID | null;
885
+ approved_at: string | null;
886
+ rejection_reason: string | null;
887
+ created_at: string;
888
+ updated_at: string;
889
+ }
890
+ type ExperiencesInsert = Omit<ExperiencesRow, 'id' | 'slug' | 'status' | 'rating_avg' | 'rating_count' | 'created_at' | 'updated_at'> & {
891
+ status?: ExperienceStatus;
892
+ };
893
+ type ExperiencesUpdate = Partial<ExperiencesRow>;
894
+ interface ExperienceImagesRow {
895
+ id: UUID;
896
+ experience_id: UUID;
897
+ url: string;
898
+ sort_order: number;
899
+ created_at: string;
900
+ }
901
+ type ExperienceImagesInsert = Omit<ExperienceImagesRow, 'id' | 'created_at'>;
902
+ type ExperienceImagesUpdate = Partial<ExperienceImagesRow>;
903
+ interface AvailabilitySlotsRow {
904
+ id: UUID;
905
+ experience_id: UUID;
906
+ start_time: string;
907
+ end_time: string;
908
+ capacity: number;
909
+ created_at: string;
910
+ updated_at: string;
911
+ }
912
+ type AvailabilitySlotsInsert = Omit<AvailabilitySlotsRow, 'id' | 'created_at' | 'updated_at'>;
913
+ type AvailabilitySlotsUpdate = Partial<AvailabilitySlotsRow>;
914
+ interface BookingsRow {
915
+ id: UUID;
916
+ user_id: UUID;
917
+ experience_id: UUID;
918
+ slot_id: UUID;
919
+ adults: number;
920
+ children: number;
921
+ total_cents: number;
922
+ currency: string;
923
+ status: BookingStatus;
924
+ expires_at: string | null;
925
+ cancel_reason: string | null;
926
+ completed_at: string | null;
927
+ subtotal_cents: number;
928
+ tax_cents: number;
929
+ created_at: string;
930
+ updated_at: string;
931
+ }
932
+ type BookingsInsert = Omit<BookingsRow, 'id' | 'status' | 'subtotal_cents' | 'tax_cents' | 'created_at' | 'updated_at'> & {
933
+ status?: BookingStatus;
934
+ subtotal_cents?: number;
935
+ tax_cents?: number;
936
+ };
937
+ type BookingsUpdate = Partial<BookingsRow>;
938
+ interface PaymentsRow {
939
+ id: UUID;
940
+ booking_id: UUID;
941
+ provider: string;
942
+ provider_ref: string | null;
943
+ amount_cents: number;
944
+ status: PaymentStatus;
945
+ paid_at: string | null;
946
+ idempotency_key: string | null;
947
+ raw_payload: Json | null;
948
+ signature_valid: boolean;
949
+ payment_method: string | null;
950
+ error_code: string | null;
951
+ error_message: string | null;
952
+ created_at: string;
953
+ }
954
+ type PaymentsInsert = Omit<PaymentsRow, 'id' | 'signature_valid' | 'created_at'> & {
955
+ signature_valid?: boolean;
956
+ };
957
+ type PaymentsUpdate = Partial<PaymentsRow>;
958
+ interface RefundsRow {
959
+ id: UUID;
960
+ payment_id: UUID;
961
+ amount_cents: number;
962
+ reason: string | null;
963
+ processed_at: string;
964
+ }
965
+ type RefundsInsert = Omit<RefundsRow, 'id' | 'processed_at'>;
966
+ type RefundsUpdate = Partial<RefundsRow>;
967
+ interface CommissionsRow {
968
+ id: UUID;
969
+ booking_id: UUID;
970
+ rate_bps: number;
971
+ commission_cents: number;
972
+ status: CommissionStatus;
973
+ payout_id: UUID | null;
974
+ created_at: string;
975
+ }
976
+ type CommissionsInsert = Omit<CommissionsRow, 'id' | 'status' | 'payout_id' | 'created_at'> & {
977
+ status?: CommissionStatus;
978
+ payout_id?: UUID | null;
979
+ };
980
+ type CommissionsUpdate = Partial<CommissionsRow>;
981
+ interface PayoutsRow {
982
+ id: UUID;
983
+ resort_id: UUID;
984
+ period_start: string;
985
+ period_end: string;
986
+ currency: string;
987
+ total_gross_cents: number;
988
+ total_commission_cents: number;
989
+ total_net_cents: number;
990
+ status: PayoutStatus;
991
+ transfer_ref: string | null;
992
+ notes: string | null;
993
+ created_at: string;
994
+ updated_at: string;
995
+ paid_at: string | null;
996
+ }
997
+ type PayoutsInsert = Omit<PayoutsRow, 'id' | 'status' | 'created_at' | 'updated_at' | 'paid_at'> & {
998
+ status?: PayoutStatus;
999
+ };
1000
+ type PayoutsUpdate = Partial<PayoutsRow>;
1001
+ interface PayoutItemsRow {
1002
+ id: UUID;
1003
+ payout_id: UUID;
1004
+ commission_id: UUID;
1005
+ booking_id: UUID;
1006
+ amount_net_cents: number;
1007
+ created_at: string;
1008
+ }
1009
+ type PayoutItemsInsert = Omit<PayoutItemsRow, 'id' | 'created_at'>;
1010
+ type PayoutItemsUpdate = Partial<PayoutItemsRow>;
1011
+ interface ReviewsRow {
1012
+ id: UUID;
1013
+ booking_id: UUID;
1014
+ user_id: UUID | null;
1015
+ experience_id: UUID;
1016
+ rating: number;
1017
+ comment: string | null;
1018
+ created_at: string;
1019
+ }
1020
+ type ReviewsInsert = Omit<ReviewsRow, 'id' | 'created_at'>;
1021
+ type ReviewsUpdate = Partial<ReviewsRow>;
1022
+ interface CategoriesRow {
1023
+ id: UUID;
1024
+ slug: string;
1025
+ name: string;
1026
+ created_at: string;
1027
+ }
1028
+ type CategoriesInsert = Omit<CategoriesRow, 'id' | 'created_at'>;
1029
+ type CategoriesUpdate = Partial<CategoriesRow>;
1030
+ interface ExperienceCategoriesRow {
1031
+ experience_id: UUID;
1032
+ category_id: UUID;
1033
+ }
1034
+ type ExperienceCategoriesInsert = ExperienceCategoriesRow;
1035
+ type ExperienceCategoriesUpdate = Partial<ExperienceCategoriesRow>;
1036
+ interface ExperienceLocationsRow {
1037
+ id: UUID;
1038
+ experience_id: UUID;
1039
+ name: string | null;
1040
+ address_line: string | null;
1041
+ latitude: number | null;
1042
+ longitude: number | null;
1043
+ meeting_instructions: string | null;
1044
+ created_at: string;
1045
+ }
1046
+ type ExperienceLocationsInsert = Omit<ExperienceLocationsRow, 'id' | 'created_at'>;
1047
+ type ExperienceLocationsUpdate = Partial<ExperienceLocationsRow>;
1048
+ interface InventoryLocksRow {
1049
+ id: UUID;
1050
+ slot_id: UUID;
1051
+ user_id: UUID | null;
1052
+ booking_id: UUID | null;
1053
+ quantity: number;
1054
+ expires_at: string;
1055
+ consumed_at: string | null;
1056
+ created_at: string;
1057
+ }
1058
+ type InventoryLocksInsert = Omit<InventoryLocksRow, 'id' | 'created_at' | 'consumed_at'> & {
1059
+ consumed_at?: string | null;
1060
+ };
1061
+ type InventoryLocksUpdate = Partial<InventoryLocksRow>;
1062
+ interface WebhookEventsRow {
1063
+ id: UUID;
1064
+ provider: string;
1065
+ provider_event_id: string | null;
1066
+ event_type: string | null;
1067
+ payload: Json;
1068
+ signature_valid: boolean;
1069
+ status: WebhookStatus;
1070
+ received_at: string;
1071
+ processed_at: string | null;
1072
+ error: string | null;
1073
+ }
1074
+ type WebhookEventsInsert = Omit<WebhookEventsRow, 'id' | 'signature_valid' | 'received_at' | 'status'> & {
1075
+ signature_valid?: boolean;
1076
+ status?: WebhookStatus;
1077
+ };
1078
+ type WebhookEventsUpdate = Partial<WebhookEventsRow>;
1079
+ interface OutboxMessagesRow {
1080
+ id: UUID;
1081
+ aggregate_type: string;
1082
+ aggregate_id: UUID | null;
1083
+ event_type: string;
1084
+ payload: Json;
1085
+ status: OutboxStatus;
1086
+ attempts: number;
1087
+ last_error: string | null;
1088
+ next_retry_at: string | null;
1089
+ created_at: string;
1090
+ }
1091
+ type OutboxMessagesInsert = Omit<OutboxMessagesRow, 'id' | 'status' | 'attempts' | 'created_at'> & {
1092
+ status?: OutboxStatus;
1093
+ attempts?: number;
1094
+ };
1095
+ type OutboxMessagesUpdate = Partial<OutboxMessagesRow>;
1096
+ interface AuditLogsRow {
1097
+ id: UUID;
1098
+ actor_user_id: UUID | null;
1099
+ actor_role: UserRole | null;
1100
+ action: string;
1101
+ entity_type: string;
1102
+ entity_id: UUID | null;
1103
+ before: Json | null;
1104
+ after: Json | null;
1105
+ ip: Inet | null;
1106
+ user_agent: string | null;
1107
+ created_at: string;
1108
+ }
1109
+ type AuditLogsInsert = Omit<AuditLogsRow, 'id' | 'created_at'>;
1110
+ type AuditLogsUpdate = Partial<AuditLogsRow>;
1111
+ interface RefreshTokensRow {
1112
+ id: UUID;
1113
+ user_id: UUID;
1114
+ jti: UUID;
1115
+ created_at: string;
1116
+ expires_at: string;
1117
+ revoked_at: string | null;
1118
+ ip: Inet | null;
1119
+ user_agent: string | null;
1120
+ }
1121
+ type RefreshTokensInsert = Omit<RefreshTokensRow, 'id' | 'created_at'>;
1122
+ type RefreshTokensUpdate = Partial<RefreshTokensRow>;
1123
+ interface EmailVerificationsRow {
1124
+ id: UUID;
1125
+ user_id: UUID;
1126
+ token: UUID;
1127
+ created_at: string;
1128
+ expires_at: string;
1129
+ used_at: string | null;
1130
+ }
1131
+ type EmailVerificationsInsert = Omit<EmailVerificationsRow, 'id' | 'created_at' | 'used_at'> & {
1132
+ used_at?: string | null;
1133
+ };
1134
+ type EmailVerificationsUpdate = Partial<EmailVerificationsRow>;
1135
+ interface PasswordResetTokensRow {
1136
+ id: UUID;
1137
+ user_id: UUID;
1138
+ token: UUID;
1139
+ created_at: string;
1140
+ expires_at: string;
1141
+ used_at: string | null;
1142
+ }
1143
+ type PasswordResetTokensInsert = Omit<PasswordResetTokensRow, 'id' | 'created_at' | 'used_at'> & {
1144
+ used_at?: string | null;
1145
+ };
1146
+ type PasswordResetTokensUpdate = Partial<PasswordResetTokensRow>;
1147
+ interface ResortDocumentsRow {
1148
+ id: UUID;
1149
+ resort_id: UUID;
1150
+ doc_type: ResortDocType;
1151
+ file_url: string;
1152
+ status: DocumentStatus;
1153
+ uploaded_at: string;
1154
+ reviewed_by: UUID | null;
1155
+ reviewed_at: string | null;
1156
+ rejection_reason: string | null;
1157
+ created_at: string;
1158
+ updated_at: string;
1159
+ }
1160
+ type ResortDocumentsInsert = Omit<ResortDocumentsRow, 'id' | 'status' | 'uploaded_at' | 'created_at' | 'updated_at'> & {
1161
+ status?: DocumentStatus;
1162
+ };
1163
+ type ResortDocumentsUpdate = Partial<ResortDocumentsRow>;
1164
+ interface ResortBankInfoRow {
1165
+ id: UUID;
1166
+ resort_id: UUID;
1167
+ bank_name: string;
1168
+ account_holder: string;
1169
+ account_number: string;
1170
+ account_type: string | null;
1171
+ tax_id: string | null;
1172
+ is_primary: boolean;
1173
+ created_at: string;
1174
+ updated_at: string;
1175
+ }
1176
+ type ResortBankInfoInsert = Omit<ResortBankInfoRow, 'id' | 'is_primary' | 'created_at' | 'updated_at'> & {
1177
+ is_primary?: boolean;
1178
+ };
1179
+ type ResortBankInfoUpdate = Partial<ResortBankInfoRow>;
1180
+ interface VSlotRemainingRow {
1181
+ slot_id: UUID;
1182
+ experience_id: UUID;
1183
+ remaining: number;
1184
+ }
1185
+
1186
+ type types_db_AuditLogsInsert = AuditLogsInsert;
1187
+ type types_db_AuditLogsRow = AuditLogsRow;
1188
+ type types_db_AuditLogsUpdate = AuditLogsUpdate;
1189
+ type types_db_AvailabilitySlotsInsert = AvailabilitySlotsInsert;
1190
+ type types_db_AvailabilitySlotsRow = AvailabilitySlotsRow;
1191
+ type types_db_AvailabilitySlotsUpdate = AvailabilitySlotsUpdate;
1192
+ type types_db_BookingStatus = BookingStatus;
1193
+ type types_db_BookingsInsert = BookingsInsert;
1194
+ type types_db_BookingsRow = BookingsRow;
1195
+ type types_db_BookingsUpdate = BookingsUpdate;
1196
+ type types_db_CategoriesInsert = CategoriesInsert;
1197
+ type types_db_CategoriesRow = CategoriesRow;
1198
+ type types_db_CategoriesUpdate = CategoriesUpdate;
1199
+ type types_db_CommissionStatus = CommissionStatus;
1200
+ type types_db_CommissionsInsert = CommissionsInsert;
1201
+ type types_db_CommissionsRow = CommissionsRow;
1202
+ type types_db_CommissionsUpdate = CommissionsUpdate;
1203
+ type types_db_DocumentStatus = DocumentStatus;
1204
+ type types_db_EmailVerificationsInsert = EmailVerificationsInsert;
1205
+ type types_db_EmailVerificationsRow = EmailVerificationsRow;
1206
+ type types_db_EmailVerificationsUpdate = EmailVerificationsUpdate;
1207
+ type types_db_ExperienceCategoriesInsert = ExperienceCategoriesInsert;
1208
+ type types_db_ExperienceCategoriesRow = ExperienceCategoriesRow;
1209
+ type types_db_ExperienceCategoriesUpdate = ExperienceCategoriesUpdate;
1210
+ type types_db_ExperienceImagesInsert = ExperienceImagesInsert;
1211
+ type types_db_ExperienceImagesRow = ExperienceImagesRow;
1212
+ type types_db_ExperienceImagesUpdate = ExperienceImagesUpdate;
1213
+ type types_db_ExperienceLocationsInsert = ExperienceLocationsInsert;
1214
+ type types_db_ExperienceLocationsRow = ExperienceLocationsRow;
1215
+ type types_db_ExperienceLocationsUpdate = ExperienceLocationsUpdate;
1216
+ type types_db_ExperienceStatus = ExperienceStatus;
1217
+ type types_db_ExperiencesInsert = ExperiencesInsert;
1218
+ type types_db_ExperiencesRow = ExperiencesRow;
1219
+ type types_db_ExperiencesUpdate = ExperiencesUpdate;
1220
+ type types_db_InventoryLocksInsert = InventoryLocksInsert;
1221
+ type types_db_InventoryLocksRow = InventoryLocksRow;
1222
+ type types_db_InventoryLocksUpdate = InventoryLocksUpdate;
1223
+ type types_db_OutboxMessagesInsert = OutboxMessagesInsert;
1224
+ type types_db_OutboxMessagesRow = OutboxMessagesRow;
1225
+ type types_db_OutboxMessagesUpdate = OutboxMessagesUpdate;
1226
+ type types_db_OutboxStatus = OutboxStatus;
1227
+ type types_db_PasswordResetTokensInsert = PasswordResetTokensInsert;
1228
+ type types_db_PasswordResetTokensRow = PasswordResetTokensRow;
1229
+ type types_db_PasswordResetTokensUpdate = PasswordResetTokensUpdate;
1230
+ type types_db_PaymentStatus = PaymentStatus;
1231
+ type types_db_PaymentsInsert = PaymentsInsert;
1232
+ type types_db_PaymentsRow = PaymentsRow;
1233
+ type types_db_PaymentsUpdate = PaymentsUpdate;
1234
+ type types_db_PayoutItemsInsert = PayoutItemsInsert;
1235
+ type types_db_PayoutItemsRow = PayoutItemsRow;
1236
+ type types_db_PayoutItemsUpdate = PayoutItemsUpdate;
1237
+ type types_db_PayoutStatus = PayoutStatus;
1238
+ type types_db_PayoutsInsert = PayoutsInsert;
1239
+ type types_db_PayoutsRow = PayoutsRow;
1240
+ type types_db_PayoutsUpdate = PayoutsUpdate;
1241
+ type types_db_RefreshTokensInsert = RefreshTokensInsert;
1242
+ type types_db_RefreshTokensRow = RefreshTokensRow;
1243
+ type types_db_RefreshTokensUpdate = RefreshTokensUpdate;
1244
+ type types_db_RefundsInsert = RefundsInsert;
1245
+ type types_db_RefundsRow = RefundsRow;
1246
+ type types_db_RefundsUpdate = RefundsUpdate;
1247
+ type types_db_ResortBankInfoInsert = ResortBankInfoInsert;
1248
+ type types_db_ResortBankInfoRow = ResortBankInfoRow;
1249
+ type types_db_ResortBankInfoUpdate = ResortBankInfoUpdate;
1250
+ type types_db_ResortDocType = ResortDocType;
1251
+ type types_db_ResortDocumentsInsert = ResortDocumentsInsert;
1252
+ type types_db_ResortDocumentsRow = ResortDocumentsRow;
1253
+ type types_db_ResortDocumentsUpdate = ResortDocumentsUpdate;
1254
+ type types_db_ResortStatus = ResortStatus;
1255
+ type types_db_ResortsInsert = ResortsInsert;
1256
+ type types_db_ResortsRow = ResortsRow;
1257
+ type types_db_ResortsUpdate = ResortsUpdate;
1258
+ type types_db_ReviewsInsert = ReviewsInsert;
1259
+ type types_db_ReviewsRow = ReviewsRow;
1260
+ type types_db_ReviewsUpdate = ReviewsUpdate;
1261
+ type types_db_UserRole = UserRole;
1262
+ type types_db_UsersInsert = UsersInsert;
1263
+ type types_db_UsersRow = UsersRow;
1264
+ type types_db_UsersUpdate = UsersUpdate;
1265
+ type types_db_VSlotRemainingRow = VSlotRemainingRow;
1266
+ type types_db_WebhookEventsInsert = WebhookEventsInsert;
1267
+ type types_db_WebhookEventsRow = WebhookEventsRow;
1268
+ type types_db_WebhookEventsUpdate = WebhookEventsUpdate;
1269
+ type types_db_WebhookStatus = WebhookStatus;
1270
+ declare namespace types_db {
1271
+ export type { types_db_AuditLogsInsert as AuditLogsInsert, types_db_AuditLogsRow as AuditLogsRow, types_db_AuditLogsUpdate as AuditLogsUpdate, types_db_AvailabilitySlotsInsert as AvailabilitySlotsInsert, types_db_AvailabilitySlotsRow as AvailabilitySlotsRow, types_db_AvailabilitySlotsUpdate as AvailabilitySlotsUpdate, types_db_BookingStatus as BookingStatus, types_db_BookingsInsert as BookingsInsert, types_db_BookingsRow as BookingsRow, types_db_BookingsUpdate as BookingsUpdate, types_db_CategoriesInsert as CategoriesInsert, types_db_CategoriesRow as CategoriesRow, types_db_CategoriesUpdate as CategoriesUpdate, types_db_CommissionStatus as CommissionStatus, types_db_CommissionsInsert as CommissionsInsert, types_db_CommissionsRow as CommissionsRow, types_db_CommissionsUpdate as CommissionsUpdate, types_db_DocumentStatus as DocumentStatus, types_db_EmailVerificationsInsert as EmailVerificationsInsert, types_db_EmailVerificationsRow as EmailVerificationsRow, types_db_EmailVerificationsUpdate as EmailVerificationsUpdate, types_db_ExperienceCategoriesInsert as ExperienceCategoriesInsert, types_db_ExperienceCategoriesRow as ExperienceCategoriesRow, types_db_ExperienceCategoriesUpdate as ExperienceCategoriesUpdate, types_db_ExperienceImagesInsert as ExperienceImagesInsert, types_db_ExperienceImagesRow as ExperienceImagesRow, types_db_ExperienceImagesUpdate as ExperienceImagesUpdate, types_db_ExperienceLocationsInsert as ExperienceLocationsInsert, types_db_ExperienceLocationsRow as ExperienceLocationsRow, types_db_ExperienceLocationsUpdate as ExperienceLocationsUpdate, types_db_ExperienceStatus as ExperienceStatus, types_db_ExperiencesInsert as ExperiencesInsert, types_db_ExperiencesRow as ExperiencesRow, types_db_ExperiencesUpdate as ExperiencesUpdate, types_db_InventoryLocksInsert as InventoryLocksInsert, types_db_InventoryLocksRow as InventoryLocksRow, types_db_InventoryLocksUpdate as InventoryLocksUpdate, types_db_OutboxMessagesInsert as OutboxMessagesInsert, types_db_OutboxMessagesRow as OutboxMessagesRow, types_db_OutboxMessagesUpdate as OutboxMessagesUpdate, types_db_OutboxStatus as OutboxStatus, types_db_PasswordResetTokensInsert as PasswordResetTokensInsert, types_db_PasswordResetTokensRow as PasswordResetTokensRow, types_db_PasswordResetTokensUpdate as PasswordResetTokensUpdate, types_db_PaymentStatus as PaymentStatus, types_db_PaymentsInsert as PaymentsInsert, types_db_PaymentsRow as PaymentsRow, types_db_PaymentsUpdate as PaymentsUpdate, types_db_PayoutItemsInsert as PayoutItemsInsert, types_db_PayoutItemsRow as PayoutItemsRow, types_db_PayoutItemsUpdate as PayoutItemsUpdate, types_db_PayoutStatus as PayoutStatus, types_db_PayoutsInsert as PayoutsInsert, types_db_PayoutsRow as PayoutsRow, types_db_PayoutsUpdate as PayoutsUpdate, types_db_RefreshTokensInsert as RefreshTokensInsert, types_db_RefreshTokensRow as RefreshTokensRow, types_db_RefreshTokensUpdate as RefreshTokensUpdate, types_db_RefundsInsert as RefundsInsert, types_db_RefundsRow as RefundsRow, types_db_RefundsUpdate as RefundsUpdate, types_db_ResortBankInfoInsert as ResortBankInfoInsert, types_db_ResortBankInfoRow as ResortBankInfoRow, types_db_ResortBankInfoUpdate as ResortBankInfoUpdate, types_db_ResortDocType as ResortDocType, types_db_ResortDocumentsInsert as ResortDocumentsInsert, types_db_ResortDocumentsRow as ResortDocumentsRow, types_db_ResortDocumentsUpdate as ResortDocumentsUpdate, types_db_ResortStatus as ResortStatus, types_db_ResortsInsert as ResortsInsert, types_db_ResortsRow as ResortsRow, types_db_ResortsUpdate as ResortsUpdate, types_db_ReviewsInsert as ReviewsInsert, types_db_ReviewsRow as ReviewsRow, types_db_ReviewsUpdate as ReviewsUpdate, types_db_UserRole as UserRole, types_db_UsersInsert as UsersInsert, types_db_UsersRow as UsersRow, types_db_UsersUpdate as UsersUpdate, types_db_VSlotRemainingRow as VSlotRemainingRow, types_db_WebhookEventsInsert as WebhookEventsInsert, types_db_WebhookEventsRow as WebhookEventsRow, types_db_WebhookEventsUpdate as WebhookEventsUpdate, types_db_WebhookStatus as WebhookStatus };
1272
+ }
1273
+
1274
+ declare const BookingConfirmed: AnySchema;
1275
+ declare const WebhookPaymentReceived: AnySchema;
1276
+
1277
+ export { type AvailabilitySlot, type Booking, BookingConfirmed, type BookingConfirmedEvent, type BookingStatus$1 as BookingStatus, type CreateBookingInput, types_db as DB, type Experience, type ExperienceStatus$1 as ExperienceStatus, type ExperienceSummary, type Money, type PaymentMethod, type PaymentProvider, type PaymentWebhookPayload, type UUID$1 as UUID, WebhookPaymentReceived, type WebhookPaymentReceivedEvent, livex_v1 as openapi };