@updraft-solutions/mcrit-sdk 0.12.0 → 0.13.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,126 @@
1
+ import { z } from "zod";
2
+ import { zContactDTO } from "./common";
3
+ import { airportSchema } from "./models";
4
+
5
+ /**
6
+ * FBO domain — flights (scheduled movements and PPRs), duties, occupations and
7
+ * the per-company FBO profile. Shapes mirror the API's FBO resources exactly:
8
+ * `FlightResource`, `DutyResource`, `OccupationResource`, and the `fbo` block on
9
+ * `CompanyResource`.
10
+ *
11
+ * Distinct from `scheduledFlightSchema` in models.ts, which predates the FBO
12
+ * domain and does not describe these payloads (it has `booking_id`,
13
+ * `departure_time`, `flight_number` — none of which the API emits here).
14
+ */
15
+
16
+ /** One acceptance axis. `status` mirrors `AcceptanceStatusData`'s `#[In]` rule. */
17
+ export const fboAcceptanceAxisSchema = z.object({
18
+ status: z.enum(["pending", "accepted", "rejected", "unknown"]),
19
+ is_required: z.boolean(),
20
+ decided_by_id: z.number().nullable(),
21
+ updated_at: z.string().nullable(),
22
+ });
23
+
24
+ export const fboAcceptanceStatusSchema = z.object({
25
+ fbo: fboAcceptanceAxisSchema,
26
+ airport: fboAcceptanceAxisSchema,
27
+ customs: fboAcceptanceAxisSchema,
28
+ });
29
+
30
+ export const fboGroundServicesSchema = z.object({
31
+ stairs: z.boolean(),
32
+ hangar: z.boolean(),
33
+ car_access: z.boolean(),
34
+ lifter: z.boolean(),
35
+ rental_car: z.boolean(),
36
+ refueling: z.boolean(),
37
+ gpu: z.boolean(),
38
+ });
39
+
40
+ export const fboFlightTypeSchema = z.enum(["scheduledFlight", "ppr"]);
41
+ export const fboFlightStatusSchema = z.enum(["active", "pending", "cancelled"]);
42
+
43
+ export const fboFlightSchema = z.object({
44
+ id: z.number(),
45
+ type: fboFlightTypeSchema,
46
+ uuid: z.string(),
47
+ flight_status: fboFlightStatusSchema,
48
+ company_id: z.number(),
49
+ author_id: z.number().nullable(),
50
+
51
+ ac_call: z.string().nullable(),
52
+ ac_reg: z.string().nullable(),
53
+ ac_type: z.string().nullable(),
54
+ operator: z.string().nullable(),
55
+
56
+ etdZ: z.string().nullable(),
57
+ /** The filer gave a date but no time; `etdZ` then holds a placeholder midnight. */
58
+ etdZ_no_time: z.boolean(),
59
+ etaZ: z.string().nullable(),
60
+ etaZ_no_time: z.boolean(),
61
+
62
+ departure_airport_id: z.number().nullable(),
63
+ departure_airport: airportSchema.optional(),
64
+ destination_airport_id: z.number().nullable(),
65
+ destination_airport: airportSchema.optional(),
66
+
67
+ ifr: z.boolean(),
68
+ wx: z.boolean(),
69
+ landings: z.number().nullable(),
70
+ remarks: z.string().nullable(),
71
+
72
+ contact: zContactDTO,
73
+ ground_services: fboGroundServicesSchema,
74
+ acceptance_status: fboAcceptanceStatusSchema,
75
+
76
+ created_at: z.string(),
77
+ updated_at: z.string(),
78
+ });
79
+
80
+ export const fboOccupationSchema = z.object({
81
+ id: z.number(),
82
+ company_id: z.number(),
83
+ author_id: z.number().nullable(),
84
+ title: z.string(),
85
+ description: z.string().nullable(),
86
+ is_absence: z.boolean(),
87
+ created_at: z.string().nullable(),
88
+ updated_at: z.string().nullable(),
89
+ });
90
+
91
+ export const fboDutySchema = z.object({
92
+ id: z.number(),
93
+ company_id: z.number().nullable(),
94
+ user_id: z.number().nullable(),
95
+ author_id: z.number().nullable(),
96
+ occupation_id: z.number().nullable(),
97
+ occupation: fboOccupationSchema.optional(),
98
+ scheduled_flight_id: z.number().nullable(),
99
+ start: z.string(),
100
+ end: z.string(),
101
+ all_day: z.boolean(),
102
+ remarks: z.string().nullable(),
103
+ created_at: z.string().nullable(),
104
+ updated_at: z.string().nullable(),
105
+ });
106
+
107
+ /** Served by `GET companies/{id}/fbo/meta` so no client hardcodes the list. */
108
+ export const fboRoleSchema = z.enum(["fbo", "atc", "wx", "customs", "handling", "fuel", "operator"]);
109
+
110
+ /** The `fbo` block on the company payload — present iff the company holds a profile. */
111
+ export const fboCompanyProfileSchema = z.object({
112
+ role: fboRoleSchema,
113
+ flights_require_approval: z.boolean(),
114
+ notify_on_movement: z.boolean(),
115
+ has_duties: z.boolean(),
116
+ has_airplanes: z.boolean(),
117
+ });
118
+
119
+ export const fboDecisionAxisSchema = z.enum(["fbo", "airport", "customs"]);
120
+ export const fboDecisionSchema = z.enum(["accepted", "rejected"]);
121
+
122
+ /** `POST companies/{id}/fbo/flights/{flight}/decision` */
123
+ export const fboDecisionInputSchema = z.object({
124
+ axis: fboDecisionAxisSchema,
125
+ status: fboDecisionSchema,
126
+ });
@@ -10,3 +10,4 @@ export * from "./equipment";
10
10
  export * from "./newsletter";
11
11
  export * from "./location-map";
12
12
  export * from "./todo";
13
+ export * from "./fbo";
@@ -0,0 +1,16 @@
1
+ import type { z } from "zod";
2
+ import type * as Fbo from "../schemas/fbo";
3
+
4
+ export type FboAcceptanceAxis = z.infer<typeof Fbo.fboAcceptanceAxisSchema>;
5
+ export type FboAcceptanceStatus = z.infer<typeof Fbo.fboAcceptanceStatusSchema>;
6
+ export type FboGroundServices = z.infer<typeof Fbo.fboGroundServicesSchema>;
7
+ export type FboFlightType = z.infer<typeof Fbo.fboFlightTypeSchema>;
8
+ export type FboFlightStatus = z.infer<typeof Fbo.fboFlightStatusSchema>;
9
+ export type FboFlight = z.infer<typeof Fbo.fboFlightSchema>;
10
+ export type FboOccupation = z.infer<typeof Fbo.fboOccupationSchema>;
11
+ export type FboDuty = z.infer<typeof Fbo.fboDutySchema>;
12
+ export type FboRole = z.infer<typeof Fbo.fboRoleSchema>;
13
+ export type FboCompanyProfile = z.infer<typeof Fbo.fboCompanyProfileSchema>;
14
+ export type FboDecisionAxis = z.infer<typeof Fbo.fboDecisionAxisSchema>;
15
+ export type FboDecision = z.infer<typeof Fbo.fboDecisionSchema>;
16
+ export type FboDecisionInput = z.infer<typeof Fbo.fboDecisionInputSchema>;
@@ -7,3 +7,4 @@ export * from "./ai";
7
7
  export * from "./roles";
8
8
  export * from "./landing-fee";
9
9
  export * from "./operating-hours";
10
+ export * from "./fbo";
File without changes
File without changes