import type React from 'react'; import { type Visit, type OpenmrsResource, type Location, type Patient } from '@openmrs/esm-framework'; import { type ColumnConfig } from '../config-schema'; export interface Attribute { attributeType: OpenmrsResource; display: string; uuid: string; value: string | number; } export interface PatientProgram { uuid: string; display: string; patient: OpenmrsResource; program: OpenmrsResource; dateEnrolled: string; dateCompleted: string; location: OpenmrsResource; } export interface QueueEntryPayload { visit: { uuid: string }; queueEntry: { status: { uuid: string }; priority: { uuid: string }; queue: { uuid: string }; patient: { uuid: string }; startedAt: Date; sortWeight: number; }; } export type AllowedPriority = OpenmrsResource; export type AllowedStatus = OpenmrsResource; export interface Provider { uuid: string; display: string; comments: string; response?: string; person: OpenmrsResource; location: string; serviceType: string; } export interface MappedQueueEntry { id: string; name: string; patientAge: string; patientSex: string; patientDob: string; patientUuid: string; queue: Queue; priority: Concept; priorityComment: string; status: Concept; visitType: string; visitUuid: string; waitTime: string; queueEntryUuid: string; queueLocation: string; sortWeight: string; } export interface EndVisitPayload { location: string; startDatetime: Date; visitType: string; stopDatetime: Date; } export interface LocationResponse { type: string; total: number; resourceType: string; meta: { lastUpdated: string; }; link: Array<{ relation: string; url: string; }>; id: string; entry: Array; } export interface LocationEntry { resource: Resource; } export interface Resource { id: string; name: string; resourceType: string; status: 'active' | 'inactive'; meta?: { tag?: Array<{ code: string; display: string; system: string; }>; }; } export interface Identifer { identifier: string; display?: string; uuid: string; identifierType: { uuid: string; display: string; }; } export interface NewVisitPayload { uuid?: string; location: string; patient?: string; startDatetime: Date; visitType: string; stopDatetime?: Date; attributes?: Array<{ attributeType: string; value: string; }>; } export interface QueueRoom { uuid: string; display: string; name: string; description: string; queue: { uuid: string; display: string; }; } export interface ProvidersQueueRoom { uuid: string; provider: { uuid: string; display: string; }; queueRoom: { uuid: string; name: string; display: string; }; } export interface WaitTime { // Older queue-module versions serialize an unavailable average as the string "NaN"; newer ones send null. averageWaitTime: number | string | null; } export interface QueueTableCellComponentProps { queueEntry: QueueEntry; } export type QueueTableColumn = { key: string; // key used by DataTable, MUST be unique for each column in the queue table header: string; // header of the column CellComponent: React.FC; // function to extract from the queue entry a searchable string representing the its value within this column. // May be null to make this column's content unsearchable getFilterableValue: (queueEntry: QueueEntry) => string | null; }; export type QueueTableColumnFunction = ( key: string, // a unique key for the column header?: string, config?: ColumnConfig, ) => QueueTableColumn; export interface Queue { uuid: string; display: string; retired?: boolean; name: string; description: string; location: Location; service: Concept; allowedPriorities: Array; allowedStatuses: Array; } export interface QueueEntry { uuid: string; display: string; endedAt: string; locationWaitingFor: Location; patient: Patient; priority: Concept; priorityComment: string | null; providerWaitingFor: Provider; queue: Queue; startedAt: string; status: Concept; visit?: Visit | null; sortWeight: number; queueComingFrom: Queue; previousQueueEntry: QueueEntry; } export interface QueueEntrySearchCriteria { queue?: Array | string; location?: Array | string; service?: Array | string; status?: Array | string; isEnded: boolean; patient?: string; } // TODO: The follow types match the types from backend. // They should be common enough to move to esm-core export interface Concept extends OpenmrsResource { setMembers?: Array; }