import { Types } from "mongoose"; import { ColorSchemaType } from "./color"; import { FireMapperAuthV2Type } from "./firemapper-auth"; import { PubNubTokenSchemaType } from "./pubnub-token"; import { AccountCallerType, AccountIndustry, DroneProvider, } from "../constants"; import { ReportNumberSchemaType } from "./common-incident"; import { GeoPolygon } from "./geojson"; export const IntegrationTypes = ["TC", "Vendor", "Hybrid"] as const; export type IntegrationType = typeof IntegrationTypes[number]; export interface WSFeedConnectionOptionsType { enabled: boolean; url: string; handshakeUrl: string; token: string; authType: string; source: string; pingIntervalSeconds: number; maxReconnectAttempts: number; reconnectDelayMS: number; socketTTLSeconds: number; } export interface WSFeedConnectionIncidentOptionsType extends WSFeedConnectionOptionsType { incidentTypesMap: Record; unitStatusCodes: UnitStatusCodesConfigType; } export interface WSFeedConnectionLocationOptionsType extends WSFeedConnectionOptionsType { isMirrored: boolean; mirrorToDepartmentIds: string[]; } export interface WebhookProcessLocationConfigType { enabled: boolean, locationUrl: string, usePartnerUrl: boolean, partnerId: string, } export interface WebhookProcessCommentConfigType { enabled: boolean, commentUrl: string, } export interface WebhookProcessVehicleStatusConfigType { enabled: boolean, vehicleStatusUrl: string, vehicleStatusListUrl: string, } export interface WebhookUnitIncidentUpdateMappingType { unitStatus: string; unitStatusCode: string; incidentUnitStatus: string; } export interface WebhookProcessUnitIncidentUpdatesConfigType { enabled: boolean, statuses: WebhookUnitIncidentUpdateMappingType[], } export interface WatchDutyFieldsType { key: string, value: string, transformationRequired: boolean, required: boolean, enabled: boolean, } export interface WebhookProcessWatchDutyConfigType { enabled: boolean, toEmail: string, ccEmail: string[], incidentFields: WatchDutyFieldsType[], optFields: WatchDutyFieldsType[], } export interface WebhookProcessConfigType { location: WebhookProcessLocationConfigType comment: WebhookProcessCommentConfigType vehicleStatus: WebhookProcessVehicleStatusConfigType unitIncidentUpdates: WebhookProcessUnitIncidentUpdatesConfigType watchduty: WebhookProcessWatchDutyConfigType } export interface WebhookAuthType { type: string; apikey: string; key: string; keySecret: string; url: string; } export interface WebhookConfigType { enabled: boolean; bulkProcessingEnabled: boolean; type: string; auth: WebhookAuthType; process: WebhookProcessConfigType; } export interface WSFeedConfigType { enabled: boolean; incident: WSFeedConnectionIncidentOptionsType; location: WSFeedConnectionLocationOptionsType; unit: WSFeedConnectionOptionsType; } export interface UnitStatusCodesConfigType { TimeDispatched: string[], TimeEnroute: string[], TimeStaged: string[], TimeCleared: string[], TimeAtHospital: string[], TimeTransporting: string[], TimeArrived: string[], } export interface Mark43ProcessLocationConfigType { enabled: boolean, locationUrl: string, } export interface Mark43ProcessCommentConfigType { enabled: boolean, commentUrl: string, usersUrl: string, defaultUserId: number, } export interface Mark43ProcessVehicleStatusConfigType { enabled: boolean, vehicleStatusUrl: string, vehicleStatusListUrl: string, } export interface Mark43ProcessConfigType { location: Mark43ProcessLocationConfigType comment: Mark43ProcessCommentConfigType vehicleStatus: Mark43ProcessVehicleStatusConfigType } export interface Mark43ConfigType { baseUrl: string, authToken: string, apiToken: string, userId: number, enabled: boolean, unitStatusCodes: UnitStatusCodesConfigType, process: Mark43ProcessConfigType } export interface GMRConfigType { baseUrl: string, authToken: string, apiToken: string, enabled: boolean, unitStatusCodes: UnitStatusCodesConfigType, webhookSecret: string, agencyId: string, radioNamePrefixesToStrip: string[], } export interface IntterraFieldsType { key: string, value: string, transformationRequired: boolean, required: boolean, enabled: boolean, } export interface IntterraConnectionType { active: boolean, fields: IntterraFieldsType[], callTypes: string[], authKey: string, authKeySecret: string, agency: string, description: string, } export interface IntterraConfigType { enabled: boolean, connections: IntterraConnectionType[], incidentWebhookEnabled: boolean, } export interface SkymiraConfigType { enabled: boolean, token: string, locationsUrl: string, } export interface ADSBConfigType { enabled: boolean, token: string, locationsUrl: string, tailNumbersAllowed: string[], squawkCodes: string[], } export interface GeotabConfigType { enabled: boolean, username: string, password: string, database: string; path: string, } export interface SomewearType { enabled: boolean } export interface PersonnelWebhookType { enabled: boolean } export interface SkytracConfigType { enabled: boolean licenseKey: string, username: string, secret: string, serviceUrl: string, configTag: string, } export interface GSTConfigType { enabled: boolean, code: string, } export interface ReplayOptionType { departmentId: string, url: string, } export interface IncidentReplayType { enabled: boolean, replays: ReplayOptionType[], } export interface SimpleSenseConfigType { token: string, } export interface StatusMappingObjectConfigType { status: string, statusCode: string, } export interface StatusMappingConfigType { TimeDispatched: StatusMappingObjectConfigType TimeEnroute: StatusMappingObjectConfigType TimeStaged: StatusMappingObjectConfigType TimeArrived: StatusMappingObjectConfigType TimeCleared: StatusMappingObjectConfigType TimeAtHospital: StatusMappingObjectConfigType TimePatient: StatusMappingObjectConfigType TimeTransporting: StatusMappingObjectConfigType TimeTransportComplete: StatusMappingObjectConfigType } export interface IncidentVehicleStatusConfigType { enabled: boolean statusMappings: StatusMappingConfigType statusExclusions: string[] } export interface FirstArrivingConfigType { token: string, apiUrl: string } export interface SafetyPriorityKeywordType { priority: number, keywords: string[], hexColor: string, } export interface WebDisclaimerType { message: string, enabled: boolean, } export interface AudioStreamAuthType { authId: Types.ObjectId, path: string, } export interface AudioStreamType { description: string, channel: string, url: string, order: number, authentication?: AudioStreamAuthType, } export interface AudioStreamGroupType { group: string, streams: AudioStreamType[], order: number, } export interface RestrictedCommentsType { enabled: boolean, callTypesAllowed: string[], statusesAllowed: string[], restrictedFields: string[], restrictedMessage: string, } export interface CustomButtonsType { name: string, url: string, order: number, allowExternal: boolean, defaultExternal: boolean, allowFloating: boolean, color: ColorSchemaType, } export interface FireMapperLayerType { pathname: string, name: string, } export interface FireMapperOutlineType { uuid: string, name: string, layer: FireMapperLayerType[], } export interface SamsaraConfigurationType { enabled: boolean, token: string, tagIds: string[], } export interface USFTConfigurationType { enabled: boolean, key: string, secret: string, radioNameMappings: Record, } export interface OneStepConfigurationType { enabled: boolean, apiKey: string, radioNameMappings: Record, } export interface DroneSenseConfigurationType { enabled: boolean, apiKey: string, } export interface DronesVideoUrlsType { web: string, } export interface DronesVideoType { sources: string[], urls: DronesVideoUrlsType, } export interface DronesConfigurationType { enabled: boolean, providers?: DroneProvider[], video: DronesVideoType, } export interface FireMapperConfigurationType { enabled: boolean, auth: FireMapperAuthV2Type, host: string, layer: FireMapperLayerType[], layerRefreshInterval: number, proLicenseCount: number, staticLayer: FireMapperOutlineType[], } export interface LicensingType { tcPro2Way: number, tcPro1Way: number, tcMobile: number, tcWeb: number, fireMapperPro: number, sendToCAD: number, tcStreams: number, } export interface IncidentTypeType { name: string, value: string, allowPartialMatch: boolean, callTypeDescription: string[], callType: string[], } export type ShareIncidentRuleTypeConfigurationArea = { name: string, objectId: number, area: GeoPolygon, }; export type ShareIncidentRuleTypeV2Always = { type: "Always", }; export type ShareIncidentRuleTypeV2AssignedUnit = { type: "AssignedUnit", radioNames: string[], }; export type ShareIncidentRuleTypeV2IncidentType = { type: "IncidentType", callTypeDescription: string[], }; export type ShareIncidentRuleTypeV2ReportNumber = { type: "ReportNumber", startsWith: ReportNumberSchemaType[], }; export type ShareIncidentRuleTypeV2Area = { type: "Area", area: ShareIncidentRuleTypeConfigurationArea[], }; export type ShareIncidentRuleTypeV2ComplexAND = { type: "ComplexAND", operands: IncidentShareRuleTypeV2[], }; export type ShareIncidentRuleTypeV2ComplexOR = { type: "ComplexOR", operands: IncidentShareRuleTypeV2[], }; export type IncidentShareRuleTypeV2 = ShareIncidentRuleTypeV2Always | ShareIncidentRuleTypeV2Area | ShareIncidentRuleTypeV2AssignedUnit | ShareIncidentRuleTypeV2ComplexAND | ShareIncidentRuleTypeV2ComplexOR | ShareIncidentRuleTypeV2IncidentType | ShareIncidentRuleTypeV2ReportNumber ; export type SharedToDestinationType = { name: string, departmentId: string, }; export interface ShareIncidentRuleTypeV2 { name?: string, accounts: SharedToDestinationType[], rules: IncidentShareRuleTypeV2[], // Temporary workaround until we add complex notification setup sendNotification: boolean, } export interface ForwardFieldsType { key: string, value: string, transformationRequired: boolean, transformationType?: string, required: boolean, enabled: boolean, } export interface ForwardingConnectionType { active: boolean, connectionType: string, fields: ForwardFieldsType[], callTypes: string[], forwardAll: boolean, apiUrl: string, authType: string, authHeader: string, authUser: string, authKey: string, authKeySecret: string, label: string, description: string, // Extended properties for SOAP and other protocols timeout?: number, namespace?: string, soapVersion?: "1.1" | "1.2", customHeaders?: Record, filter?: ForwardingConnectionFilterType, } export interface ForwardingConnectionFilterType { radioNames?: string[], } export interface VehicleStatusWebhookConnectionType { active: boolean, connectionType: string, fields: ForwardFieldsType[], apiUrl: string, apiKey: string, authType: string, authHeader: string, description: string, includeStation: boolean, } export interface ForwardingConfigType { enabled: boolean, connections: ForwardingConnectionType[], } export interface VehicleStatusWebhookConfigType { enabled: boolean, connections: VehicleStatusWebhookConnectionType[], } export type AccountContact = { department: string, name: string, phone: string, email: string, }; export type AccountAddress = { address: string, city: string, state: string, zipCode: string, country: string, }; export interface Connectivity { enabled: boolean, staleMinutes: number, heartbeatMinutes: number, } export interface StatusConnectivity extends Connectivity { ackUnitsCount: number, } export type AccountConnectivity = { incident: Connectivity, location: Connectivity, status: StatusConnectivity, }; export type Coordinate = { longitude: number, latitude: number, }; export type AccountConfigurationShareAVL = { enabled: boolean, opAreaName: string, opAreaCode: string, fadeZoomLevel: number, // When sharing location, only view what's in this area area: GeoPolygon[], }; export type AccountConfigurationShareIncident = { enabled: boolean, rulesV2: ShareIncidentRuleTypeV2[], }; export type AccountConfigurationZonehaven = { enabled: boolean, visible: boolean, layerUrl: string, fadeZoomLevel: number, // References ZonehavenAccount.name - empty string means unassigned/legacy fallback. accountName: string, }; export type AccountConfigurationWatchDuty = { enabled: boolean, visible: boolean, }; export type ManagedIncidentPriorityItem = { title: string, color: ColorSchemaType, position: number, }; export type ManagedIncidentPriority = { label: string, items: ManagedIncidentPriorityItem[], }; export type ManagedIncidentModeItem = { title: string, color: ColorSchemaType, position: number, }; export type ManagedIncidentMode = { label: string, items: ManagedIncidentModeItem[], }; export type AccountConfigurationCallerLocationResolver = { type: AccountCallerType, opts: Record, }; export type AccountConfigurationCallerLocation = { enabled: boolean, resolvers: AccountConfigurationCallerLocationResolver[] }; export interface CADGetLocationSettingsType { includeModems: boolean, selectModemsManually: boolean, includeGeotab: boolean, selectGeotabManually: boolean, } export interface CADToCADConfigType { departmentId: string, defaultAgencyId: string, cadTransferCode: string, transferUsers: boolean, transferModems: boolean, } export interface CADToCADType { enabled: boolean, allowedDepartments: CADToCADConfigType[], } export interface DepartmentType { _id: Types.ObjectId, id?: string, accountType: string, ackDelimiter: string, active: boolean, activeUserCount: number, addressDetails: AccountAddress, addUserInstructions: string, adsb: ADSBConfigType, agencyIds: Types.ObjectId[], cadInterfaceMetaDataId?: Types.ObjectId | null, integrationType?: IntegrationType | "", allowShareWith3rdParties: boolean, apikey: string, arcGISMapsEnabled: boolean, audioConfiguration: AudioStreamGroupType[] authSource: string[], beaconEnabled: boolean, beansAIEnabled: boolean, cadAllowedIPAddresses: string[] cadAllowIgnoreAfterDays: number, cadToCAD: CADToCADType, cadBidirectionalEnabled: boolean, cadBidirectionalException: boolean, cadEmailUsername: string, cadGetLocationEnabled: boolean, cadGetLocationSettings: CADGetLocationSettingsType, cadIncidentEventType: string[], cadIncidentHistoryType: number[], cadOneWayVehiclesEnabled: boolean, callerLocation: AccountConfigurationCallerLocation, callTypeBlock: string[], connectivity: AccountConnectivity, contact: AccountContact, customButtons: CustomButtonsType[], defaultMapPosition: Coordinate, department: string, esriGeoJSONFilename: string, externalNotificationsEnabled: boolean, fdid: string, fireMapPDFReader: string, fireMapper: FireMapperConfigurationType, firstArriving: FirstArrivingConfigType, firstArrivingEnabled: boolean, forwarding: ForwardingConfigType, geotab: GeotabConfigType, gst: GSTConfigType, inAppRoutingEnabled: boolean, incidentReplay: IncidentReplayType, incidentTypes: IncidentTypeType[], incidentVehicleStatus: IncidentVehicleStatusConfigType, industry: AccountIndustry, intterra: IntterraConfigType, licensing: LicensingType, locationStaleMinutes: number, locationAircraftStaleMinutes: number, logOffEnabled: boolean, managedIncidentMode: ManagedIncidentMode, managedIncidentPriority: ManagedIncidentPriority, mark43: Mark43ConfigType, gmr: GMRConfigType, minPasswordLength: number, modified_unix_date: number, modified: Date, mowsEnabled: boolean, notificationEmails: string[] orientationMarkerColor: ColorSchemaType, partialApiKey: string, personnelStaffingEnabled: boolean, personnelWebhook: PersonnelWebhookType, pubNubV3: PubNubTokenSchemaType, remoteLoggingEnabled: boolean, reportNumberEnabled: boolean, reportOdometer: string, restrictedComments: RestrictedCommentsType, rosteringEnabled: boolean, rosteringShiftDefault: number, rtsChannelPrefix: string, rtsEnabled: boolean, safetyPriorityKeywords: SafetyPriorityKeywordType[], samsara: SamsaraConfigurationType, usft: USFTConfigurationType, onestep: OneStepConfigurationType, // cspell:disable-line dronesense: DroneSenseConfigurationType, drones: DronesConfigurationType, selfAssignmentEnabled: boolean, shareAVL: AccountConfigurationShareAVL, shareIncident: AccountConfigurationShareIncident, shareLocationPhones: boolean, shareLocationTablets: boolean, signupDomains: string[], signupKey: string, simpleSense: SimpleSenseConfigType, simpleSenseEnabled: boolean, skymira: SkymiraConfigType, skytrac: SkytracConfigType[], socketIO: PubNubTokenSchemaType, somewear: SomewearType, speedReportingEnabled: boolean, timeZone: string, userContributionEnabled: boolean, uuid: string, vehicleRadioNameIsStable: boolean, vehicleStatusWebhook: VehicleStatusWebhookConfigType, vehicleSwapEnabled: boolean, webDisclaimer: WebDisclaimerType, webhook: WebhookConfigType, wsFeed: WSFeedConfigType, zonehaven: AccountConfigurationZonehaven, watchDuty: AccountConfigurationWatchDuty, }