import { CompositionClaim } from 'gdc-common-utils-ts/models'; import type { MetaTagCoding } from 'gdc-common-utils-ts/models/confidential-storage'; import type { RouteContext } from './individual-onboarding.js'; import type { PollOptions, SubmitAndPollResult } from './orchestration/client-port.js'; export type DigitalTwinFhirFormat = 'org.hl7.fhir.r4' | 'org.hl7.fhir.api'; /** Returns whether a value can be used as a pseudonymous digital-twin subject. */ export declare function isDigitalTwinSubjectId(value: unknown): value is string; /** Rejects operational DIDs and malformed or caller-invented subject shapes. */ export declare function assertDigitalTwinSubjectId(value: unknown): asserts value is string; /** Search parameters evaluated against a ResearchSubject's canonical Composition index. */ export declare const DigitalTwinSearchParameter: Readonly<{ Section: "section"; DateFrom: "date-from"; DateTo: "date-to"; Text: "text"; MetaTag: "Composition.meta-tag"; }>; export type DigitalTwinSearchInput = { /** SMART bearer used for this research operation. */ accessToken?: string; thid?: string; format?: DigitalTwinFhirFormat; /** Public twin search resource; exposed for low-level request inspection only. */ resourceType?: 'ResearchSubject'; /** One or more IPS section tokens. Basic search uses OR across sections. */ sections?: readonly string[]; /** Inclusive clinical-event lower bound as ISO date or dateTime. */ dateFrom?: string; /** Inclusive upper bound. When omitted, GW resolves its current time. */ dateTo?: string; /** Case- and accent-insensitive text matched against GW's private derived index. */ text?: string; /** Advanced/compatibility filters. Do not combine with basic-search fields. */ filters?: Readonly>; pollOptions?: PollOptions; }; /** * One public ResearchSubject digital twin returned by search. * * `composition` is an SDK-only normalized view of the canonical Composition: * it comes from mixed `meta.claims` in claims-first API responses or from * `ResearchSubject.contained[]` in strict FHIR R4/R5. GW never emits an * ad-hoc `ResearchSubject.composition` wire property. The canonical index joins * the ResearchSubject to resources later returned by `$summary`. */ export type DigitalTwinSearchMatch = Record & { resourceType?: 'ResearchSubject'; id?: string; [CompositionClaim.Subject]: string; [CompositionClaim.Section]?: string; composition?: Record; meta?: { tag?: DigitalTwinResearchTag[]; }; }; /** High-level search result; GW transport envelopes remain available for diagnostics. */ export type DigitalTwinSearchResult = { total: number; matches: DigitalTwinSearchMatch[]; operation: SubmitAndPollResult; }; export type DigitalTwinMaterializationInput = { /** SMART bearer used for this research operation. */ accessToken?: string; twinSubjectId: string; thid?: string; format?: DigitalTwinFhirFormat; sections?: readonly string[]; sent?: string; pollOptions?: PollOptions; }; /** Ledger-safe employee-defined marker attached to a research working copy. */ export type DigitalTwinResearchTag = Required> & Pick & { /** Stable position/name for the tag in the Composition metadata. */ id?: string; }; /** * Tag chosen by a professional when saving a personal workset. * `userSelected` is intentionally absent: the SDK persists it as `true`. */ export type DigitalTwinWorksetTagInput = Omit; /** * Saves a researcher-owned Composition working selection for one twin. * * This does not mutate the canonical twin or copy clinical data. The record * stores the pseudonymous subject, section, author and ledger-safe tags used * to recover the researcher's working set later. */ export type DigitalTwinSelectionInput = { accessToken?: string; twinSubjectId: string; section: string; tags: readonly DigitalTwinWorksetTagInput[]; /** * Operational hosted employee DID. High-level callers should omit this: * `DigitalTwinSdk` binds it to the authenticated actor session. */ authorDid?: string; /** Optional FHIR logical id for this saved selection. A UUID is generated when omitted. */ selectionId?: string; /** @deprecated Use `selectionId`; retained for low-level compatibility. */ compositionId?: string; documentType?: string; date?: string; thid?: string; format?: DigitalTwinFhirFormat; pollOptions?: PollOptions; }; /** * Builds one opaque FHIR logical id for a saved working selection. * * Ownership remains in the standard `Composition.author` claim. Reopening a * a saved collection uses `meta.tag` plus that author; no non-FHIR branch * claims or employee hashes in tag systems exist. */ export declare function buildDigitalTwinSelectionIdentifier(input: Readonly<{ selectionId?: string; }>): Readonly<{ selectionId: string; compositionId: string; }>; export type DigitalTwinRuntimeDeps = { digitalTwinSearchPath: (ctx: RouteContext, format: DigitalTwinFhirFormat, resourceType: string) => string; digitalTwinSearchPollPath: (ctx: RouteContext, format: DigitalTwinFhirFormat, resourceType: string) => string; digitalTwinCommunicationBatchPath: (ctx: RouteContext, format: DigitalTwinFhirFormat) => string; digitalTwinCommunicationPollPath: (ctx: RouteContext, format: DigitalTwinFhirFormat) => string; digitalTwinCompositionBatchPath: (ctx: RouteContext, format: DigitalTwinFhirFormat) => string; digitalTwinCompositionPollPath: (ctx: RouteContext, format: DigitalTwinFhirFormat) => string; submitAndPoll: (submitPath: string, pollPath: string, payload: { thid: string; body: Record; }, pollOptions?: PollOptions) => Promise; }; /** Opens the GW async response and exposes the matched ResearchSubjects directly. */ export declare function readDigitalTwinSearchResult(operation: SubmitAndPollResult): DigitalTwinSearchResult; /** Persists one tagged researcher working copy through `digitaltwin/Composition/_batch`. */ export declare function saveDigitalTwinSelectionWithDeps(ctx: RouteContext, input: DigitalTwinSelectionInput, deps: DigitalTwinRuntimeDeps): Promise; /** * Searches ResearchSubject digital twins through the public asynchronous route. * GW filters their canonical Composition index documents internally; callers * never switch to a separate public Composition search surface. */ export declare function searchDigitalTwinsWithDeps(ctx: RouteContext, input: DigitalTwinSearchInput, deps: DigitalTwinRuntimeDeps): Promise; /** Materializes one selected pseudonymous twin as a research summary Bundle. */ export declare function materializeDigitalTwinWithDeps(ctx: RouteContext, input: DigitalTwinMaterializationInput, deps: DigitalTwinRuntimeDeps): Promise;