import { Uuid, Base64String, Metadata } from './shared' import { MetadataCategory } from './workflow' export interface LockboxCreateResponse { lockboxUuid: Uuid } export interface SharedSecretResponse { sharedSecret: Base64String } export interface LockboxGrantRequest { granteeUuid: Uuid encryptedSecret: Base64String } export interface LockboxDataRequest { publicMetadata?: Metadata privateMetadata?: Base64String data: Base64String } export type LockboxManifest = ManifestEntry[] export interface ManifestEntry { dataUuid: Uuid metadata: Metadata } export interface GrantedLockboxes { grants: Grant[] } export interface Grant { lockboxOwnerUuid?: Uuid encryptedLockbox?: Base64String lockboxUuid?: Uuid } export interface DataCreateResponse { dataUuid: Uuid } export interface DataResponse { data: Base64String } export interface IndexEntry { uuid?: Uuid uniqueHash?: Base64String timestamp?: Date } export interface IndexConsultLockbox extends IndexEntry { consultationId: Uuid grant: Grant } export interface VaultIndex extends IndexEntry { [IndexKey.ConsultationLockbox]?: IndexConsultLockbox[] // only one should ever exist at a time [IndexKey.Consultation]?: IndexConsultLockbox[] // DEPRECATED REMOVE ME } export interface EncryptedVaultIndex { [IndexKey.Consultation]?: EncryptedIndexEntry[] [IndexKey.ConsultationLockbox]?: EncryptedIndexEntry[] [IndexKey.IndexSnapshot]?: EncryptedIndexEntry[] } export interface EncryptedIndexEntry extends IndexEntry { encryptedIndexEntry: Base64String } export enum IndexKey { Consultation = 'Consultation', //DEPRECATED REMOVE ME IndexSnapshot = 'IndexSnapshot', //DEPRECATED REMOVE ME ConsultationLockbox = 'ConsultationLockbox' } export interface Document extends ManifestEntry { lockboxOwnerUuid?: Uuid lockboxUuid: Uuid } export interface Meta { documentType?: DocumentType category: MetadataCategory contentType?: string } export interface PreferenceMeta extends Meta { category: MetadataCategory.Preference contentType: 'application/json' } export interface RecoveryMeta extends Meta { category: MetadataCategory.Recovery contentType: 'application/json' } export interface RawConsultationMeta extends Meta { category: MetadataCategory.Raw contentType: 'application/json' consultationId?: Uuid } export interface ConsultationMeta extends Meta { documentType: DocumentType category: MetadataCategory.Consultation consultationId?: Uuid } export interface ConsultationImageMeta extends ConsultationMeta { idbId: Uuid } export interface MedicalMeta extends Meta { documentType: | DocumentType.PopulatedWorkflowData | DocumentType.Result | DocumentType.Prescription | DocumentType.DoctorsNote category: MetadataCategory.Medical consultationIds?: Uuid[] } export interface PersonalMeta { documentType: DocumentType.PopulatedWorkflowData | DocumentType.Note category: | MetadataCategory.Personal | MetadataCategory.ChildPersonal | MetadataCategory.OtherPersonal consultationIds?: Uuid[] } export enum DocumentType { Message = 'Message', Note = 'Note', DoctorsNote = 'DoctorsNote', Prescription = 'Prescription', ExamRequest = 'ExamRequest', Result = 'Result', Attachment = 'Attachment', BigFile = 'BigFile', MeetingRequest = 'MeetingRequest', AudioNote = 'AudioNote', VideoNote = 'VideoNote', PopulatedWorkflowData = 'PopulatedWorkflowData', TreatmentPlan = 'TreatmentPlan', ImageAlias = 'ImageAlias', } export interface LocalizedData { lockboxOwnerUuid?: string lockboxUuid: string dataUuid: string data: T }