diff --git a/index.ts b/index.ts index 216b47a..fa9fbb1 100644 --- a/index.ts +++ b/index.ts @@ -3,5 +3,5 @@ export * from './src/types/geographic-address'; export * from './src/types/service-qualification'; export * from './src/types/shared'; export * from './src/types/confirm-order'; +export * from './src/types/service-ordering'; export * as Auth from './src/types/auth'; - diff --git a/package-lock.json b/package-lock.json index 2b94306..4d0b233 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ozmap/ozn-sdk", - "version": "0.0.1-1066-4", + "version": "0.0.1-1058-4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@ozmap/ozn-sdk", - "version": "0.0.1-1066-4", + "version": "0.0.1-1058-4", "license": "MIT", "dependencies": { "zod": "^3.24.2" diff --git a/package.json b/package.json index 40f2309..372d5cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ozmap/ozn-sdk", - "version": "0.0.1-1066-4", + "version": "0.0.1-1058-4", "description": "OZN SDK is a powerful tool for developers to build their own applications on top of OZN using TMForum pattern.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/types/resource-pool-management.ts b/src/types/resource-pool-management.ts index aa1f940..6a74863 100644 --- a/src/types/resource-pool-management.ts +++ b/src/types/resource-pool-management.ts @@ -75,5 +75,14 @@ export const ResourcePoolManagementOutputSchema = z.object({ reservationItem: z.array(ReservationItemSchemaOutput), }); + +export const CancelReservationSchema = z.object({ + relatedParty: RelatedPartySchema, + reservationItem: z.object({ + reservationState: z.string(), + }), +}); + +export type CancelReservationInput = z.infer; export type ResourcePoolManagementInput = z.infer; export type ResourcePoolManagementOutput = z.infer; diff --git a/src/types/service-ordering.ts b/src/types/service-ordering.ts new file mode 100644 index 0000000..f4e1733 --- /dev/null +++ b/src/types/service-ordering.ts @@ -0,0 +1,142 @@ +import { z } from 'zod'; + +const resourceSchema = z + .array( + z.object({ + name: z.string(), + resource: z.object({ + property: z.array( + z.object({ + name: z.string(), + value: z.string(), + }), + ), + component: z.array(z.any()).optional(), + resource: z.array(z.any()).optional(), + }), + }), + ) + .nullable() + .optional(); + +const actionEnum = z.enum(['add', 'modify', 'delete', 'modifyPort']); + +export const PortReplaceDetailEnum = z.enum([ + 'crossing', + 'closerCTO', + 'signalIssue', + 'blockedAccess', + 'fullCTO', + 'operationalError', + 'occupied', + 'noSignal', + 'attenuated', + 'others', +]); + +export type PortReplaceDetailEnum = z.infer; + +export const ServiceOrderInputSchema = z.object({ + externalId: z.string(), + category: z.string(), + orderDate: z.string(), + requesterCallback: z.string(), + relatedParty: z.array( + z.object({ + role: z.string(), + property: z.array( + z.object({ + name: z.string(), + value: z.string(), + }), + ), + }), + ), + orderItem: z + .array( + z.object({ + id: z.string(), + action: actionEnum, + serviceSpecification: z.array( + z.object({ + id: z.string(), + }), + ), + service: z + .array( + z.object({ + id: z.string(), + category: z.string(), + serviceCharacteristic: z + .array( + z.object({ + name: z.string(), + value: z.string(), + characteristic: z.string().nullable().optional(), + }), + ) + .optional(), + resource: resourceSchema, + }), + ) + .max(1), + }), + ) + .max(1), +}); + +export const ServiceOrderOutputSchema = z.object({ + id: z.string(), + externalId: z.string(), + description: z.string().nullable(), + category: z.string(), + note: z.string(), + state: z.string(), + orderDate: z.string(), + requesterCallback: z.string(), + relatedParty: z.array( + z.object({ + role: z.string(), + property: z.array( + z.object({ + name: z.string(), + value: z.string(), + }), + ), + }), + ), + orderItem: z.array( + z.object({ + id: z.string(), + action: actionEnum, + requestedCompletionDate: z.string().nullable(), + state: z.string(), + statusMessage: z.string().nullable(), + serviceSpecification: z.object({ + id: z.string(), + }), + orderItemRelationship: z.array(z.any()), + service: z.object({ + id: z.string(), + category: z.string(), + changeReason: z.string().nullable(), + name: z.string().nullable(), + description: z.string().nullable(), + place: z.array(z.any()), + serviceCharacteristic: z.array( + z.object({ + name: z.string(), + value: z.string(), + }), + ), + serviceRelationship: z.array(z.any()), + relatedParty: z.any().nullable(), + component: z.array(z.any()).optional(), + resource: resourceSchema, + }), + }), + ), +}); + +export type ServiceOrderInput = z.infer; +export type ServiceOrderOutput = z.infer; \ No newline at end of file