Circle V2 API Docs
    Preparing search index...

    Variable apiConst

    api: DecoratedRouterRecord<
        {
            ctx: TRPCContext;
            errorShape: DefaultErrorShape;
            meta: object;
            transformer: false;
        },
        DecorateCreateRouterOptions<
            {
                auditRuns: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            createResponseTrail: MutationProcedure<
                                {
                                    input: | {
                                        auditResponseId: string;
                                        comment?: (...)
                                        | (...);
                                        kind: "existing";
                                        markedAs: (...) | (...) | (...);
                                    }
                                    | {
                                        auditQuestionId: string;
                                        auditRunId: string;
                                        comment?: (...)
                                        | (...);
                                        kind: "manual";
                                        markedAs: (...) | (...) | (...);
                                    };
                                    meta: object;
                                    output: {
                                        audit_response_id: string & { __brand: ... };
                                        comment: string | null;
                                        created_at: DbDate;
                                        created_by: (...) & (...) | null;
                                        id: AuditResponseTrailId;
                                        marked_as: "pass" | "fail" | "not_applicable";
                                    };
                                },
                            >;
                            getById: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        auditRun: {
                                            archived: boolean;
                                            audit_template_id: (...) | (...);
                                            case_id: (...) | (...);
                                            created_at: DbDate;
                                            created_by: (...) | (...);
                                            hidden: boolean;
                                            id: AuditRunId;
                                            patient_first_name: (...) | (...);
                                            patient_id: (...) | (...);
                                            patient_last_name: (...) | (...);
                                            session_id: (...) | (...);
                                            status: (...) | (...);
                                            summary: (...) | (...);
                                            template_name: (...) | (...);
                                            treatment_episode_id: (...) | (...);
                                            trigger: (...) | (...);
                                            triggered_at: (...) | (...);
                                        };
                                        hasPendingResponses: boolean;
                                        lastSync: ResolveAuditRunSyncServiceResult;
                                        responses: LegacyAuditRunResponseViewModel[];
                                        score: number
                                        | null;
                                        statusCounts: AuditRunStatusCounts;
                                        templateQuestionCount: number;
                                    };
                                },
                            >;
                            listForPatient: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        dateFrom?: string;
                                        dateTo?: string;
                                        excludeAuditRunIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        patientId: string;
                                        resultStatus?: unknown;
                                        search?: string;
                                        sortOrder?: "asc" | "desc";
                                        templateIds?: (...)[];
                                        treatmentEpisodeId?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<PatientRecentReviewRunListItem>;
                                },
                            >;
                            listRecentForPatient: QueryProcedure<
                                {
                                    input: {
                                        patientId: string;
                                        treatmentEpisodeId?: string;
                                        type?: "chart_review"
                                        | "session_notes";
                                    };
                                    meta: object;
                                    output: ListRecentPatientReviewRunsServiceResult;
                                },
                            >;
                        },
                    >,
                >;
                auditTemplates: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: {
                                        customReviewCriteriaPrompt?: string;
                                        customSummaryPrompt?: string;
                                        description?: string;
                                        name: string;
                                        questions?: (...)[];
                                    };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: (...) & (...)
                                        | null;
                                        custom_review_criteria_prompt: string | null;
                                        custom_summary_prompt: string | null;
                                        description: string | null;
                                        id: AuditTemplateId;
                                        name: string | null;
                                        org_id: (...) & (...) | null;
                                        share_with_org: boolean | null;
                                        shared_by: (...) & (...) | null;
                                        shared_with_entity_id: (...) & (...) | null;
                                        updated_at: (...) & (...) | null;
                                    };
                                },
                            >;
                            delete: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: (...) & (...) | null;
                                        custom_review_criteria_prompt: string | null;
                                        custom_summary_prompt: string | null;
                                        description: string | null;
                                        id: AuditTemplateId;
                                        name: string | null;
                                        org_id: (...) & (...) | null;
                                        share_with_org: boolean | null;
                                        shared_by: (...) & (...) | null;
                                        shared_with_entity_id: (...) & (...) | null;
                                        updated_at: (...) & (...) | null;
                                    };
                                },
                            >;
                            duplicate: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: (...) & (...) | null;
                                        custom_review_criteria_prompt: string | null;
                                        custom_summary_prompt: string | null;
                                        description: string | null;
                                        id: AuditTemplateId;
                                        name: string | null;
                                        org_id: (...) & (...) | null;
                                        share_with_org: boolean | null;
                                        shared_by: (...) & (...) | null;
                                        shared_with_entity_id: (...) & (...) | null;
                                        updated_at: (...) & (...) | null;
                                    };
                                },
                            >;
                            getById: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        auditTemplate: {
                                            created_at: DbDate;
                                            created_by: (...) | (...);
                                            custom_review_criteria_prompt: (...) | (...);
                                            custom_summary_prompt: (...) | (...);
                                            description: (...) | (...);
                                            id: AuditTemplateId;
                                            name: (...) | (...);
                                            org_id: (...) | (...);
                                            share_with_org: (...) | (...) | (...);
                                            shared_by: (...) | (...);
                                            shared_with_entity_id: (...) | (...);
                                            updated_at: (...) | (...);
                                        };
                                        questions: {
                                            created_at: ...;
                                            created_by: ...;
                                            id: ...;
                                            manual: ...;
                                            org_id: ...;
                                            question: ...;
                                            question_order: ...;
                                            question_type: ...;
                                            share_with_org: ...;
                                            shared_by: ...;
                                            shared_with_entity_id: ...;
                                            template_id: ...;
                                            updated_at: ...;
                                        }[];
                                        triggers: ((...) & (...))[];
                                    };
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sortBy?: "name"
                                        | "created_at";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            created_at: DbDate;
                                            created_by: (...)
                                            | (...);
                                            custom_review_criteria_prompt: (...) | (...);
                                            custom_summary_prompt: (...) | (...);
                                            description: (...) | (...);
                                            id: AuditTemplateId;
                                            name: (...) | (...);
                                            org_id: (...) | (...);
                                            question_count: (...) | (...);
                                            share_with_org: (...) | (...) | (...);
                                            triggers: (...)[];
                                        },
                                    >;
                                },
                            >;
                            toggleSharing: MutationProcedure<
                                {
                                    input: { id: string; shared: boolean };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: (...) & (...) | null;
                                        custom_review_criteria_prompt: string | null;
                                        custom_summary_prompt: string | null;
                                        description: string | null;
                                        id: AuditTemplateId;
                                        name: string | null;
                                        org_id: (...) & (...) | null;
                                        share_with_org: boolean | null;
                                        shared_by: (...) & (...) | null;
                                        shared_with_entity_id: (...) & (...) | null;
                                        updated_at: (...) & (...) | null;
                                    };
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        customReviewCriteriaPrompt?: string
                                        | null;
                                        customSummaryPrompt?: string | null;
                                        description?: string | null;
                                        id: string;
                                        name?: string;
                                        questions?: (...)[];
                                    };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: (...) & (...)
                                        | null;
                                        custom_review_criteria_prompt: string | null;
                                        custom_summary_prompt: string | null;
                                        description: string | null;
                                        id: AuditTemplateId;
                                        name: string | null;
                                        org_id: (...) & (...) | null;
                                        share_with_org: boolean | null;
                                        shared_by: (...) & (...) | null;
                                        shared_with_entity_id: (...) & (...) | null;
                                        updated_at: (...) & (...) | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                chartReview: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            run: MutationProcedure<
                                {
                                    input: {
                                        auditSource?: "manual"
                                        | "queue"
                                        | "api";
                                        patientId: string;
                                        sessionId?: string;
                                        templateIds: string[];
                                        treatmentEpisodeId?: string;
                                        trigger?: string;
                                        triggeredAt?: string;
                                    };
                                    meta: object;
                                    output: { auditRunIds: AuditRunId[] };
                                },
                            >;
                            syncAndRun: MutationProcedure<
                                {
                                    input: {
                                        episodeId?: string;
                                        patientId: string;
                                        templateIds: string[];
                                    };
                                    meta: object;
                                    output: SyncAndRunOutput;
                                },
                            >;
                        },
                    >,
                >;
                chartReviewTriggers: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: {
                                        auditTemplateIds: string[];
                                        facilities?: (...)[];
                                        intervalSeconds: number | null;
                                        name: string;
                                        schedule?: { schedule: ...; timezone: ... } | null;
                                        timeAfterTriggerSeconds: number;
                                        triggerType: "admission" | "discharge" | "utilization_end";
                                    };
                                    meta: object;
                                    output: {
                                        audit_template_id: AuditTemplateId
                                        | null;
                                        audit_templates: TriggerAuditTemplate[];
                                        created_at: DbDate;
                                        deleted: boolean;
                                        enabled: boolean;
                                        entity_id: number & { __brand: ... };
                                        filters: { facilities: ...; level_of_care_ids: ... } | null;
                                        id: ChartReviewTriggerId;
                                        interval_seconds: number | null;
                                        last_run_at: string | null;
                                        name: string;
                                        schedule: { schedule: ...; timezone: ... } | null;
                                        time_after_trigger_seconds: number;
                                        trigger_type: "admission" | "discharge" | "utilization_end";
                                        updated_at: DbDate;
                                    };
                                },
                            >;
                            delete: MutationProcedure<
                                {
                                    input: { triggerId: string };
                                    meta: object;
                                    output: {
                                        audit_template_id: AuditTemplateId | null;
                                        created_at: DbDate;
                                        deleted: boolean;
                                        enabled: boolean;
                                        entity_id: number & { __brand: ... };
                                        filters: { facilities: ...; level_of_care_ids: ... } | null;
                                        id: ChartReviewTriggerId;
                                        interval_seconds: number | null;
                                        last_run_at: string | null;
                                        name: string;
                                        schedule: { schedule: ...; timezone: ... } | null;
                                        time_after_trigger_seconds: number;
                                        trigger_type: "admission" | "discharge" | "utilization_end";
                                        updated_at: DbDate;
                                    };
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        audit_template_id: (...)
                                        | (...);
                                        audit_templates: (...)[];
                                        created_at: DbDate;
                                        deleted: boolean;
                                        enabled: boolean;
                                        entity_id: (...) & (...);
                                        filters: { facilities: ...; level_of_care_ids: ... };
                                        filters_display: { facilities: ...; level_of_care_count: ... };
                                        id: ChartReviewTriggerId;
                                        interval_seconds: (...) | (...);
                                        last_run_at: (...) | (...);
                                        name: string;
                                        schedule: (...) | (...);
                                        time_after_trigger_seconds: number;
                                        trigger_type: (...) | (...) | (...);
                                        updated_at: DbDate;
                                    }[];
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        auditTemplateIds: string[];
                                        facilities?: (...)[];
                                        id: string;
                                        intervalSeconds: number | null;
                                        name: string;
                                        schedule?: { schedule: ...; timezone: ... } | null;
                                        timeAfterTriggerSeconds: number;
                                    };
                                    meta: object;
                                    output: {
                                        audit_template_id: AuditTemplateId
                                        | null;
                                        audit_templates: TriggerAuditTemplate[];
                                        created_at: DbDate;
                                        deleted: boolean;
                                        enabled: boolean;
                                        entity_id: number & { __brand: ... };
                                        filters: { facilities: ...; level_of_care_ids: ... } | null;
                                        id: ChartReviewTriggerId;
                                        interval_seconds: number | null;
                                        last_run_at: string | null;
                                        name: string;
                                        schedule: { schedule: ...; timezone: ... } | null;
                                        time_after_trigger_seconds: number;
                                        trigger_type: "admission" | "discharge" | "utilization_end";
                                        updated_at: DbDate;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                chat: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            sendMessage: MutationProcedure<
                                {
                                    input: {
                                        messages: { content: ...; id: ...; role: ... }[];
                                        patientId: string;
                                    };
                                    meta: object;
                                    output: RunCaseReviewChatResult;
                                },
                            >;
                        },
                    >,
                >;
                contacts: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: { contactTypeId?: string; fieldValues?: (...)[] };
                                    meta: object;
                                    output: {
                                        contact_id: ContactId;
                                        contact_type: string;
                                        created_at: DbDate;
                                        created_by: string | null;
                                        org_id: number;
                                    };
                                },
                            >;
                            delete: MutationProcedure<
                                { input: { contactId: string }; meta: object; output: void },
                            >;
                            get: QueryProcedure<
                                {
                                    input: { contactId: string };
                                    meta: object;
                                    output: {
                                        contact_id: ContactId;
                                        contact_type: string;
                                        contact_type_id: ContactTypeId;
                                        contact_type_name: string;
                                        created_at: DbDate;
                                        created_by: string | null;
                                        fieldValues: { field_id: ...; key: ...; value: ...; value_id: ... }[];
                                        org_id: number;
                                    };
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: {
                                        contactTypeId?: string;
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sortBy?: "name"
                                        | "created_at";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            contact_id: ContactId;
                                            contact_type: string;
                                            contact_type_name: string;
                                            created_at: DbDate;
                                            created_by: (...)
                                            | (...);
                                            name: (...) | (...);
                                            org_id: number;
                                        },
                                    >;
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        contactId: string;
                                        contactTypeId?: string;
                                        fieldValues?: (...)[];
                                    };
                                    meta: object;
                                    output: void;
                                },
                            >;
                        },
                    >,
                >;
                contactTypes: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: { customFields?: (...)[]; name: string };
                                    meta: object;
                                    output: {
                                        contact_type_id: ContactTypeId;
                                        created_at: DbDate;
                                        created_by: string;
                                        org_id: number | null;
                                        type: string;
                                    };
                                },
                            >;
                            delete: MutationProcedure<
                                { input: { contactTypeId: string }; meta: object; output: void },
                            >;
                            get: QueryProcedure<
                                {
                                    input: { contactTypeId: string };
                                    meta: object;
                                    output: {
                                        contact_type_id: ContactTypeId;
                                        created_at: DbDate;
                                        created_by: string;
                                        fields: {
                                            contact_type: ...;
                                            created_at: ...;
                                            field_id: ...;
                                            key: ...;
                                        }[];
                                        org_id: number
                                        | null;
                                        type: string;
                                    };
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        contact_count: number;
                                        contact_type_id: ContactTypeId;
                                        created_at: DbDate;
                                        created_by: string;
                                        field_count: number;
                                        org_id: (...)
                                        | (...);
                                        type: string;
                                    }[];
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        contactTypeId: string;
                                        fieldIdsToRemove?: (...)[];
                                        fieldsToAdd?: (...)[];
                                        name?: string;
                                    };
                                    meta: object;
                                    output: void;
                                },
                            >;
                        },
                    >,
                >;
                facilities: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: {
                                        integration?: | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... };
                                        name: string;
                                    };
                                    meta: object;
                                    output: | {
                                        created_at: DbDate;
                                        entity_id: (...) & (...);
                                        id: FacilityId;
                                        name: string;
                                        timezone: (...) | (...);
                                        updated_at: DbDate;
                                    }
                                    | {
                                        facility: {
                                            created_at: ...;
                                            entity_id: ...;
                                            id: ...;
                                            name: ...;
                                            timezone: ...;
                                            updated_at: ...;
                                        };
                                        integration: {
                                            created_at: ...;
                                            created_by: ...;
                                            credentials: ...;
                                            entity_id: ...;
                                            facility_id: ...;
                                            id: ...;
                                            label: ...;
                                            last_sync: ...;
                                            status: ...;
                                            type: ...;
                                            updated_at: ...;
                                        };
                                    };
                                },
                            >;
                            delete: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: { success: boolean };
                                },
                            >;
                            listInOrganization: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<{ id: FacilityId; name: string }>;
                                },
                            >;
                            listWithIntegrations: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        id: FacilityId;
                                        integration_credentials: (...)
                                        | (...)
                                        | (...)
                                        | (...)
                                        | (...);
                                        integration_id: (...) | (...);
                                        integration_label: (...) | (...);
                                        integration_status: (...) | (...) | (...) | (...);
                                        integration_type: (...) | (...) | (...) | (...) | (...);
                                        last_sync: (...) | (...);
                                        name: string;
                                    }[];
                                },
                            >;
                            listWithLevelsOfCare: QueryProcedure<
                                { input: void; meta: object; output: FacilityWithLevelsOfCare[] },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        id: string;
                                        integration?: | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... };
                                        name: string;
                                    };
                                    meta: object;
                                    output: UpdateFacilityWithIntegrationResult;
                                },
                            >;
                        },
                    >,
                >;
                integrations: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            fullSync: MutationProcedure<
                                {
                                    input: { dry_run?: boolean; integration_id: string };
                                    meta: object;
                                    output: {
                                        chart_reviews_enqueued: number;
                                        patients_enqueued: number;
                                        success: true;
                                    };
                                },
                            >;
                            getIntegrationLocations: QueryProcedure<
                                {
                                    input: | {
                                        credentials: {
                                            api_id: ...;
                                            api_secret: ...;
                                            realm_id: ...;
                                            sunwave_email: ...;
                                        };
                                        type: "sunwave";
                                    }
                                    | { credentials: { bearer_token: ... }; type: "lightningstep" }
                                    | { credentials: { app_id: ... }; type: "kipu" };
                                    meta: object;
                                    output:
                                        | FetchSunwaveLocationsResult
                                        | FetchKipuLocationsResult
                                        | FetchLightningStepLocationsResult;
                                },
                            >;
                            syncAdmissions: MutationProcedure<
                                {
                                    input: {
                                        dry_run?: boolean;
                                        end_date?: string;
                                        integration_id: string;
                                        start_date?: string;
                                    };
                                    meta: object;
                                    output: {
                                        error: null;
                                        patients?: (...)[];
                                        stats?: {
                                            date_range?: ...;
                                            records_fetched: ...;
                                            records_upserted?: ...;
                                        };
                                        success: true;
                                    };
                                },
                            >;
                            syncEpisode: MutationProcedure<
                                {
                                    input: { episodeId: string; syncDocuments?: boolean };
                                    meta: object;
                                    output: SyncEpisodeServiceResult;
                                },
                            >;
                            syncFacilityLevelsOfCare: MutationProcedure<
                                {
                                    input: { integrationId: string };
                                    meta: object;
                                    output: SyncFacilityLevelsOfCareServiceResult;
                                },
                            >;
                            syncFacilityPrograms: MutationProcedure<
                                {
                                    input: { integrationId: string };
                                    meta: object;
                                    output: SyncFacilityProgramsServiceResult;
                                },
                            >;
                            syncIntegration: MutationProcedure<
                                {
                                    input: {
                                        dateRange?: { from: ...; to: ... };
                                        integrationId: string;
                                    };
                                    meta: object;
                                    output: void;
                                },
                            >;
                            syncIntegrationEpisodes: MutationProcedure<
                                {
                                    input: {
                                        endDate: unknown;
                                        integrationId: string;
                                        startDate: unknown;
                                    };
                                    meta: object;
                                    output: SyncIntegrationEpisodesServiceResult;
                                },
                            >;
                            syncPatient: MutationProcedure<
                                {
                                    input: {
                                        dryRun?: boolean;
                                        patientId: string;
                                        syncDocuments?: boolean;
                                    };
                                    meta: object;
                                    output: { success: true }
                                    | SyncPatientEpisodesServiceResult;
                                },
                            >;
                            syncPatientEpisodes: MutationProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: SyncPatientEpisodesServiceResult;
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        id: string;
                                        integration?: | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... };
                                        label?: string;
                                        status?: "active" | "inactive";
                                    };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: string
                                        | null;
                                        credentials:
                                            | {
                                                access_id: ...;
                                                app_id: ...;
                                                location_id: ...;
                                                location_name?: ...;
                                                secret_key: ...;
                                            }
                                            | { bearer_token: ...; location_ids: ...; location_name?: ... }
                                            | {
                                                api_id: ...;
                                                api_secret: ...;
                                                location_name?: ...;
                                                realm_id: ...;
                                                service_facility_id: ...;
                                                sunwave_email: ...;
                                            }
                                            | {
                                                base_url: ...;
                                                client_id: ...;
                                                rpa_vault_user_id: ...;
                                                rpa_workflow_id: ...;
                                                secret_key: ...;
                                            };
                                        entity_id: number & { __brand: ... };
                                        facility_id: FacilityId | null;
                                        id: IntegrationId;
                                        label: string | null;
                                        last_sync: string | null;
                                        status: "error" | "active" | "inactive";
                                        type: "kipu" | "lightningstep" | "sunwave" | "qualifacts_insync";
                                        updated_at: DbDate;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                metrics: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            criteriaAssistants: QueryProcedure<
                                {
                                    input: {
                                        auditTemplateIds?: (...)[];
                                        cursor?: number;
                                        dateRange: { from: string; to: string };
                                        facilityIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        scoreRange?: { max?: ...; min?: ... };
                                        search?: string;
                                        sortBy?:
                                            | "name"
                                            | "needs_review"
                                            | "avg_score"
                                            | "total_reviews"
                                            | "passed";
                                        sortOrder?: "asc"
                                        | "desc";
                                    };
                                    meta: object;
                                    output: {
                                        audit_template_id: (...)
                                        | (...);
                                        audit_template_name: (...) | (...);
                                    }[];
                                },
                            >;
                            criteriaDetail: QueryProcedure<
                                {
                                    input: {
                                        auditTemplateId: string;
                                        auditTemplateIds?: (...)[];
                                        cursor?: number;
                                        dateRange: { from: string; to: string };
                                        facilityIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        profileId?: string;
                                        scoreRange?: { max?: ...; min?: ... };
                                        search?: string;
                                        sortBy?:
                                            | "question"
                                            | "needs_review"
                                            | "avg_score"
                                            | "total_reviews"
                                            | "passed";
                                        sortOrder?: "asc"
                                        | "desc";
                                    };
                                    meta: object;
                                    output: {
                                        items: {
                                            audit_question_id: ...;
                                            avg_score: ...;
                                            is_scoreable: ...;
                                            needs_review: ...;
                                            passed: ...;
                                            pending_count: ...;
                                            question: ...;
                                            total_reviews: ...;
                                            total_rows: ...;
                                        }[];
                                        nextCursor: number
                                        | null;
                                        providers: { provider_name: ...; provider_profile_id: ... }[];
                                        total: number;
                                    };
                                },
                            >;
                            criteriaResponses: QueryProcedure<
                                {
                                    input: {
                                        auditQuestionId: string;
                                        auditTemplateId: string;
                                        auditTemplateIds?: (...)[];
                                        cursor?: number;
                                        dateRange: { from: string; to: string };
                                        facilityIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        profileId?: string;
                                        scoreRange?: { max?: ...; min?: ... };
                                        search?: string;
                                        sortBy?:
                                            | "name"
                                            | "needs_review"
                                            | "avg_score"
                                            | "total_reviews"
                                            | "passed";
                                        sortOrder?: "asc"
                                        | "desc";
                                        status?: "pass" | "fail" | "needs_review";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            audit_run_id: AuditRunId;
                                            client_name: string;
                                            facility_name: string;
                                            patient_id: PatientId;
                                            reasoning: string;
                                            response_id: AuditResponseId;
                                            run_created_at: string;
                                            session_id: (...)
                                            | (...);
                                            sources: (...)[];
                                            status: (...) | (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            metricsFacilities: QueryProcedure<
                                {
                                    input: {
                                        auditTemplateIds?: (...)[];
                                        cursor?: number;
                                        dateRange: { from: string; to: string };
                                        facilityIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        scoreRange?: { max?: ...; min?: ... };
                                        search?: string;
                                        sortBy?:
                                            | "name"
                                            | "needs_review"
                                            | "avg_score"
                                            | "total_reviews"
                                            | "passed";
                                        sortOrder?: "asc"
                                        | "desc";
                                    };
                                    meta: object;
                                    output: {
                                        attention_rate: number;
                                        facility_id: (...)
                                        | (...);
                                        facility_name: string;
                                        pass_rate: number;
                                        total_clients: number;
                                        total_criteria: number;
                                        total_pass: number;
                                    }[];
                                },
                            >;
                            metricsGrouped: QueryProcedure<
                                {
                                    input: {
                                        auditTemplateIds?: (...)[];
                                        cursor?: number;
                                        dateRange: { from: string; to: string };
                                        dimension: "client" | "provider" | "assistant";
                                        facilityIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        scoreRange?: { max?: ...; min?: ... };
                                        search?: string;
                                        sortBy?:
                                            | "name"
                                            | "needs_review"
                                            | "avg_score"
                                            | "total_reviews"
                                            | "passed";
                                        sortOrder?: "asc"
                                        | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            avg_score: string;
                                            id: (...)
                                            | (...);
                                            name: string;
                                            needs_review: string;
                                            passed: string;
                                            total_reviews: string;
                                            total_rows: string;
                                        },
                                    >;
                                },
                            >;
                        },
                    >,
                >;
                orgMembers: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            createInvite: MutationProcedure<
                                {
                                    input: {
                                        email: string;
                                        firstName: string;
                                        lastName: string;
                                        roleId: number;
                                        title?: string;
                                    };
                                    meta: object;
                                    output: InviteUserServiceResult;
                                },
                            >;
                            getMemberByProfileId: QueryProcedure<
                                {
                                    input: { profileId: string };
                                    meta: object;
                                    output: {
                                        email: string | null;
                                        first_name: string | null;
                                        id: ProfileId;
                                        is_superadmin: boolean;
                                        last_name: string | null;
                                        role: UserRole;
                                        role_id: number & { __brand: ... };
                                        title: string | null;
                                        user_id: (...) & (...) | null;
                                    };
                                },
                            >;
                            listPendingInvites: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sortBy?: "name"
                                        | "email";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            email: string;
                                            first_name: (...)
                                            | (...);
                                            id: PendingInviteId;
                                            last_name: (...) | (...);
                                            role_id: number;
                                            role_name: (...) | (...);
                                            title: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listRoles: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<{ role_id: RoleId; role_name: string }>;
                                },
                            >;
                            listUsers: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        roleId?: unknown;
                                        search?: string;
                                        sortBy?: "name"
                                        | "email";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            email: (...)
                                            | (...);
                                            first_name: (...) | (...);
                                            id: ProfileId;
                                            is_superadmin: boolean;
                                            last_name: (...) | (...);
                                            role: UserRole;
                                            role_id: (...) & (...);
                                            role_name: string;
                                            title: (...) | (...);
                                            user_id: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            removeMember: MutationProcedure<
                                {
                                    input: { profileId: string };
                                    meta: object;
                                    output: { profileId: ProfileId };
                                },
                            >;
                            resendInvite: MutationProcedure<
                                {
                                    input: { pendingInviteId: number };
                                    meta: object;
                                    output: ResendInviteServiceResult;
                                },
                            >;
                            updateMember: MutationProcedure<
                                {
                                    input: {
                                        email: string;
                                        firstName: string;
                                        isSuperadmin: boolean;
                                        lastName: string;
                                        profileId: string;
                                        role: "individual"
                                        | "supervisor"
                                        | "admin";
                                        title?: string;
                                    };
                                    meta: object;
                                    output: {
                                        email: string
                                        | null;
                                        first_name: string | null;
                                        id: ProfileId;
                                        is_superadmin: boolean;
                                        last_name: string | null;
                                        role: UserRole;
                                        role_id: number & { __brand: ... };
                                        title: string | null;
                                        user_id: (...) & (...) | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                orgSettings: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            list: QueryProcedure<
                                {
                                    input: { entityId: number };
                                    meta: object;
                                    output: OrgSettingListItem[];
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        entityId: number;
                                        key: | "emrIntegrationEnabled"
                                        | "sessionNoteGenerationEnabled"
                                        | "chartReviewEnabled"
                                        | "formFillingEnabled";
                                        value: unknown;
                                    };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        entity_id: number & { __brand: ... };
                                        id: EntitySettingId;
                                        setting_key:
                                            | "emrIntegrationEnabled"
                                            | "sessionNoteGenerationEnabled"
                                            | "chartReviewEnabled"
                                            | "formFillingEnabled";
                                        updated_at: DbDate;
                                        updated_by: (...) & (...)
                                        | null;
                                        value: boolean;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                patientCharts: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            countForPatient: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: { count: number };
                                },
                            >;
                            createForPatient: MutationProcedure<
                                {
                                    input: {
                                        fileName: string;
                                        patientId: string;
                                        storageKey: string;
                                    };
                                    meta: object;
                                    output: {
                                        circle_metadata: | {
                                            admittedAt: ...;
                                            capturedAt: ...;
                                            dischargedAt: ...;
                                            entityId: ...;
                                            episodeEnd?: ...;
                                            episodeStart?: ...;
                                            levelOfCareEnd?: ...;
                                            levelOfCareName?: ...;
                                            levelOfCareStart?: ...;
                                            patientId: ...;
                                            patientName: ...;
                                        }
                                        | null;
                                        created_at: DbDate;
                                        created_by: (...) & (...)
                                        | null;
                                        embedding_count: string | null;
                                        embedding_err_msg: string | null;
                                        embedding_status:
                                            | "processing"
                                            | "failed"
                                            | "pending"
                                            | "parse"
                                            | "extract"
                                            | "completed"
                                            | null;
                                        entity_id: (...) & (...)
                                        | null;
                                        external_document_created_at: (...) & (...) | null;
                                        external_document_id: string | null;
                                        external_document_type:
                                            | "kipu_evaluation"
                                            | "kipu_consent_form"
                                            | "kipu_ciwa_ar"
                                            | "kipu_ciwa_b"
                                            | "kipu_group_session"
                                            | "lightningstep_formdata"
                                            | "lightningstep_txplan"
                                            | "kipu_vital_signs"
                                            | "kipu_orthostatic_vital_signs"
                                            | "kipu_patient_orders"
                                            | "kipu_glucose_logs"
                                            | "kipu_program_history"
                                            | "kipu_diagnosis_history"
                                            | "kipu_appointment"
                                            | "lightningstep_admissions"
                                            | "kipu_episode_outcome"
                                            | "sunwave_form"
                                            | "sunwave_diagnosis"
                                            | "sunwave_group_note"
                                            | "sunwave_program"
                                            | "sunwave_lab_result"
                                            | "sunwave_assessment"
                                            | "emr_insurance_information"
                                            | "insync_episode_summary"
                                            | "insync_condition"
                                            | "insync_vital_signs"
                                            | "insync_lab_result"
                                            | "insync_observation"
                                            | "insync_allergy"
                                            | "insync_immunization"
                                            | "insync_medication_request"
                                            | "insync_diagnostic_report"
                                            | "insync_procedure"
                                            | null;
                                        external_document_updated_at: (...) & (...)
                                        | null;
                                        file_name: string | null;
                                        file_type:
                                            | "patient_chart"
                                            | "generated_form"
                                            | "emr_document"
                                            | null;
                                        file_url: string
                                        | null;
                                        id: PatientChartId;
                                        integration_id: (...) & (...) | null;
                                        is_ready: boolean | null;
                                        patient_id: (...) & (...) | null;
                                        raw_document: unknown;
                                        run_id: string | null;
                                        sources: unknown;
                                        treatment_episode_id: (...) & (...) | null;
                                        updated_at: (...) & (...) | null;
                                    };
                                },
                            >;
                            getById: QueryProcedure<
                                {
                                    input: { id: string; patientId: string };
                                    meta: object;
                                    output: {
                                        circle_metadata:
                                            | {
                                                admittedAt: ...;
                                                capturedAt: ...;
                                                dischargedAt: ...;
                                                entityId: ...;
                                                episodeEnd?: ...;
                                                episodeStart?: ...;
                                                levelOfCareEnd?: ...;
                                                levelOfCareName?: ...;
                                                levelOfCareStart?: ...;
                                                patientId: ...;
                                                patientName: ...;
                                            }
                                            | null;
                                        created_at: DbDate;
                                        embedding_err_msg: string
                                        | null;
                                        embedding_status:
                                            | "processing"
                                            | "failed"
                                            | "pending"
                                            | "parse"
                                            | "extract"
                                            | "completed"
                                            | null;
                                        external_document_type: | "kipu_evaluation"
                                        | "kipu_consent_form"
                                        | "kipu_ciwa_ar"
                                        | "kipu_ciwa_b"
                                        | "kipu_group_session"
                                        | "lightningstep_formdata"
                                        | "lightningstep_txplan"
                                        | "kipu_vital_signs"
                                        | "kipu_orthostatic_vital_signs"
                                        | "kipu_patient_orders"
                                        | "kipu_glucose_logs"
                                        | "kipu_program_history"
                                        | "kipu_diagnosis_history"
                                        | "kipu_appointment"
                                        | "lightningstep_admissions"
                                        | "kipu_episode_outcome"
                                        | "sunwave_form"
                                        | "sunwave_diagnosis"
                                        | "sunwave_group_note"
                                        | "sunwave_program"
                                        | "sunwave_lab_result"
                                        | "sunwave_assessment"
                                        | "emr_insurance_information"
                                        | "insync_episode_summary"
                                        | "insync_condition"
                                        | "insync_vital_signs"
                                        | "insync_lab_result"
                                        | "insync_observation"
                                        | "insync_allergy"
                                        | "insync_immunization"
                                        | "insync_medication_request"
                                        | "insync_diagnostic_report"
                                        | "insync_procedure"
                                        | null;
                                        file_name: string
                                        | null;
                                        file_type:
                                            | "patient_chart"
                                            | "generated_form"
                                            | "emr_document"
                                            | null;
                                        file_url: string
                                        | null;
                                        id: PatientChartId;
                                        patient_id: (...) & (...) | null;
                                        raw_document: unknown;
                                        signed_url: string | null;
                                    };
                                },
                            >;
                            listForPatient: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        dateFrom?: string;
                                        dateTo?: string;
                                        fileType?: unknown;
                                        limit?: number;
                                        offset?: number;
                                        patientId: string;
                                        search?: string;
                                        sortOrder?: "asc"
                                        | "desc";
                                        treatmentEpisodeId?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            created_at: DbDate;
                                            embedding_status: | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                            external_document_created_at: (...) | (...);
                                            file_name: (...) | (...);
                                            file_type: (...) | (...) | (...) | (...);
                                            file_url: (...) | (...);
                                            id: PatientChartId;
                                            patient_id: (...) | (...);
                                            treatment_episode_id: (...) | (...);
                                            updated_at: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listGeneratedFormsForPatient: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        dateFrom?: string;
                                        dateTo?: string;
                                        limit?: number;
                                        offset?: number;
                                        patientId: string;
                                        search?: string;
                                        sortOrder?: "asc"
                                        | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            created_at: DbDate;
                                            embedding_err_msg: (...)
                                            | (...);
                                            embedding_status:
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...);
                                            file_name: (...) | (...);
                                            file_type: (...) | (...) | (...) | (...);
                                            file_url: (...) | (...);
                                            form_id: (...) | (...);
                                            form_run_error_msg: (...) | (...);
                                            form_run_finished_at: (...) | (...);
                                            form_run_status: (...) | (...);
                                            id: PatientChartId;
                                            is_ready: (...) | (...) | (...);
                                            patient_id: (...) | (...);
                                            run_id: (...) | (...);
                                            sources: unknown;
                                            updated_at: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                        },
                    >,
                >;
                patients: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            createPatient: MutationProcedure<
                                {
                                    input: {
                                        addressCity?: string;
                                        addressState?: string;
                                        addressStreet1?: string;
                                        addressStreet2?: string;
                                        addressZipcode?: string;
                                        dob?: string;
                                        email?: string;
                                        facilityId?: string;
                                        firstName: string;
                                        gender?: string;
                                        intakeNotes?: string;
                                        lastName: string;
                                        phoneMobile?: string;
                                    };
                                    meta: object;
                                    output: {
                                        address_city: string
                                        | null;
                                        address_state: string | null;
                                        address_street1: string | null;
                                        address_street2: string | null;
                                        address_zipcode: string | null;
                                        created_at: DbDate;
                                        created_by: UserId | null;
                                        dob: string | null;
                                        email: string | null;
                                        entity_id: (...) & (...) | null;
                                        external_patient_id: string | null;
                                        external_source:
                                            | "kipu"
                                            | "lightningstep"
                                            | "sunwave"
                                            | "qualifacts_insync"
                                            | null;
                                        facility_id: (...) & (...)
                                        | null;
                                        first_name: string | null;
                                        gender: string | null;
                                        intake_notes: string | null;
                                        last_name: string | null;
                                        last_updated_summary: string | null;
                                        patient_id: PatientId;
                                        phone_mobile: string | null;
                                        primary_provider_id: (...) & (...) | null;
                                        status: string | null;
                                        summary: LegacyPatientSummary | null;
                                    };
                                },
                            >;
                            deletePatient: MutationProcedure<
                                { input: { id: string }; meta: object; output: { id: PatientId } },
                            >;
                            getPatientById: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        address_city: string | null;
                                        address_state: string | null;
                                        address_street1: string | null;
                                        address_street2: string | null;
                                        address_zipcode: string | null;
                                        created_at: DbDate;
                                        created_by: UserId | null;
                                        dob: string | null;
                                        email: string | null;
                                        entity_id: (...) & (...) | null;
                                        external_patient_id: string | null;
                                        external_source:
                                            | "kipu"
                                            | "lightningstep"
                                            | "sunwave"
                                            | "qualifacts_insync"
                                            | null;
                                        facility_id: (...) & (...)
                                        | null;
                                        first_name: string | null;
                                        gender: string | null;
                                        intake_notes: string | null;
                                        last_name: string | null;
                                        last_updated_summary: string | null;
                                        patient_id: PatientId;
                                        phone_mobile: string | null;
                                        primary_provider_id: (...) & (...) | null;
                                        status: string | null;
                                        summary: LegacyPatientSummary | null;
                                    };
                                },
                            >;
                            getPatientDetail: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        admitted_at: string | null;
                                        created_at: DbDate;
                                        discharged_at: string | null;
                                        dob: string | null;
                                        external_source:
                                            | "kipu"
                                            | "lightningstep"
                                            | "sunwave"
                                            | "qualifacts_insync"
                                            | null;
                                        facility_id: (...) & (...)
                                        | null;
                                        facility_name: string | null;
                                        first_name: string | null;
                                        last_name: string | null;
                                        last_sync: string | null;
                                        patient_id: PatientId;
                                        primary_provider_id: (...) & (...) | null;
                                        provider_first_name: string | null;
                                        provider_last_name: string | null;
                                        provider_title: string | null;
                                    };
                                },
                            >;
                            getPatientOverview: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        patient: {
                                            admitted_at: (...) | (...);
                                            created_at: DbDate;
                                            creator_first_name: (...) | (...);
                                            creator_last_name: (...) | (...);
                                            discharged_at: (...) | (...);
                                            external_source: (...) | (...) | (...) | (...) | (...);
                                            facility_name: (...) | (...);
                                            first_name: (...) | (...);
                                            last_name: (...) | (...);
                                            last_sync: (...) | (...);
                                            last_updated_summary: (...) | (...);
                                            patient_id: PatientId;
                                            provider_first_name: (...) | (...);
                                            provider_last_name: (...) | (...);
                                            provider_title: (...) | (...);
                                            summary: (...) | (...);
                                        };
                                        recentSessions: {
                                            ai_summarized_note: ...;
                                            as_summarized_note_type: ...;
                                            audit_run_id: ...;
                                            audit_status: ...;
                                            case_id: ...;
                                            cpt_code: ...;
                                            created_at: ...;
                                            created_by: ...;
                                            dsm_code: ...;
                                            end_timestamp: ...;
                                            error_msg: ...;
                                            file_url: ...;
                                            icd_code: ...;
                                            id: ...;
                                            manual_entry: ...;
                                            patient_id: ...;
                                            private_note: ...;
                                            progress_status: ...;
                                            selected_template: ...;
                                            start_timestamp: ...;
                                            transcript: ...;
                                            updated_by: ...;
                                        }[];
                                    };
                                },
                            >;
                            listEpisodes: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: {
                                        admission_date: string;
                                        discharge_date: (...) | (...);
                                        external_id: (...) | (...);
                                        facility_name: (...) | (...);
                                        id: TreatmentEpisodeId;
                                        integration_id: (...) | (...);
                                        integration_status: (...) | (...) | (...) | (...);
                                        last_synced_documents: (...) | (...);
                                        status: (...) | (...);
                                    }[];
                                },
                            >;
                            listInOrganization: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        facilityId?: unknown;
                                        limit?: number;
                                        offset?: number;
                                        patientIds?: unknown;
                                        patientSearch?: string;
                                        primaryProviderId?: unknown;
                                        sortBy?: "name"
                                        | "created_at"
                                        | "admitted_at"
                                        | "discharged_at";
                                        sortOrder?: "asc" | "desc";
                                        status?: unknown;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            admitted_at: (...)
                                            | (...);
                                            created_at: DbDate;
                                            discharged_at: (...) | (...);
                                            dob: (...) | (...);
                                            entity_id: (...) | (...);
                                            facility_id: (...) | (...);
                                            facility_name: (...) | (...);
                                            first_name: (...) | (...);
                                            last_name: (...) | (...);
                                            last_updated_summary: (...) | (...);
                                            patient_id: PatientId;
                                            primary_provider_id: (...) | (...);
                                            provider_first_name: (...) | (...);
                                            provider_last_name: (...) | (...);
                                            provider_title: (...) | (...);
                                            status: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            mergePatients: MutationProcedure<
                                {
                                    input: { duplicatePatientId: string; primaryPatientId: string };
                                    meta: object;
                                    output: ExecutePatientMergeServiceResult;
                                },
                            >;
                            updatePatient: MutationProcedure<
                                {
                                    input: {
                                        addressCity?: string;
                                        addressState?: string;
                                        addressStreet1?: string;
                                        addressStreet2?: string;
                                        addressZipcode?: string;
                                        dob?: string;
                                        email?: string;
                                        facilityId?: string;
                                        firstName: string;
                                        gender?: string;
                                        id: string;
                                        intakeNotes?: string;
                                        lastName: string;
                                        phoneMobile?: string;
                                    };
                                    meta: object;
                                    output: {
                                        address_city: string
                                        | null;
                                        address_state: string | null;
                                        address_street1: string | null;
                                        address_street2: string | null;
                                        address_zipcode: string | null;
                                        created_at: DbDate;
                                        created_by: UserId | null;
                                        dob: string | null;
                                        email: string | null;
                                        entity_id: (...) & (...) | null;
                                        external_patient_id: string | null;
                                        external_source:
                                            | "kipu"
                                            | "lightningstep"
                                            | "sunwave"
                                            | "qualifacts_insync"
                                            | null;
                                        facility_id: (...) & (...)
                                        | null;
                                        first_name: string | null;
                                        gender: string | null;
                                        intake_notes: string | null;
                                        last_name: string | null;
                                        last_updated_summary: string | null;
                                        patient_id: PatientId;
                                        phone_mobile: string | null;
                                        primary_provider_id: (...) & (...) | null;
                                        status: string | null;
                                        summary: LegacyPatientSummary | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                patientSessions: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            delete: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        ai_summarized_note: string | null;
                                        as_summarized_note_type: string | null;
                                        audit_run_id: (...) & (...) | null;
                                        audit_status:
                                            | "error"
                                            | "pass"
                                            | "fail"
                                            | "needs_review"
                                            | "pending"
                                            | "in_progress"
                                            | "not_started"
                                            | null;
                                        case_id: (...) & (...)
                                        | null;
                                        cpt_code: (...)[] | null;
                                        created_at: DbDate;
                                        created_by: string | null;
                                        dsm_code: (...)[] | null;
                                        end_timestamp: DbDate;
                                        error_msg: string | null;
                                        file_url: string | null;
                                        icd_code: (...)[] | null;
                                        id: SessionId;
                                        manual_entry: boolean | null;
                                        patient_id: (...) & (...) | null;
                                        private_note: string | null;
                                        progress_status:
                                            | "initialized"
                                            | "processing"
                                            | "transcribing"
                                            | "complete"
                                            | "failed"
                                            | null;
                                        selected_template: | {
                                            additional_ai_instructions?: ...;
                                            check_cpt?: ...;
                                            check_demo?: ...;
                                            check_dsm_5?: ...;
                                            check_icd_10?: ...;
                                            created_by?: ...;
                                            created_by_circle?: ...;
                                            hidden_instructions?: ...;
                                            id: ...;
                                            is_allow_bullet_points?: ...;
                                            is_unstructured_narrative?: ...;
                                            last_updated?: ...;
                                            last_used?: ...;
                                            name?: ...;
                                            original_template_id?: ...;
                                            sections: ...;
                                            selected_audit_template_ids?: ...;
                                            shared_with_org_id?: ...;
                                            title: ...;
                                            [key: ...]: ...;
                                        }
                                        | null;
                                        start_timestamp: DbDate;
                                        transcript: string
                                        | null;
                                        updated_by: number | null;
                                    };
                                },
                            >;
                            generateNote: MutationProcedure<
                                {
                                    input: {
                                        fileUrl?: string;
                                        manualText?: string;
                                        patientId: string;
                                        templateId: string;
                                    };
                                    meta: object;
                                    output: ProcessTextNoteResult;
                                },
                            >;
                            getById: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        patientSession: {
                                            ai_summarized_note: (...) | (...);
                                            audit_run_id: (...) | (...);
                                            audit_status:
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...);
                                            case_id: (...) | (...);
                                            created_at: DbDate;
                                            created_by: (...) | (...);
                                            dsm_code: (...)[];
                                            end_timestamp: DbDate;
                                            file_url: (...) | (...);
                                            icd_code: (...)[];
                                            id: SessionId;
                                            manual_entry: (...) | (...) | (...);
                                            patient_id: (...) | (...);
                                            private_note: (...) | (...);
                                            progress_status: (...) | (...) | (...) | (...) | (...) | (...);
                                            selected_template: (...) | (...);
                                            start_timestamp: DbDate;
                                            transcript: (...) | (...);
                                        };
                                        sessionAuditRunIds: AuditRunId[];
                                    };
                                },
                            >;
                            getLastTemplateForPatient: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: { templateId: TemplateId | null };
                                },
                            >;
                            getPlaybackUrl: QueryProcedure<
                                {
                                    input: { sessionId: string };
                                    meta: object;
                                    output: { signedUrl: null } | { signedUrl: string };
                                },
                            >;
                            getRecentSessions: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: { sessions: Safe<(...)[]> };
                                },
                            >;
                            listForCurrentUser: QueryProcedure<
                                {
                                    input: { from: string; to: string };
                                    meta: object;
                                    output: {
                                        sessions: {
                                            end_timestamp: ...;
                                            id: ...;
                                            patient_first_name: ...;
                                            patient_id: ...;
                                            patient_last_name: ...;
                                            progress_status: ...;
                                            selected_template: ...;
                                            start_timestamp: ...;
                                        }[];
                                    };
                                },
                            >;
                            listForPatient: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        dateFrom?: string;
                                        dateTo?: string;
                                        limit?: number;
                                        offset?: number;
                                        patientId: string;
                                        search?: string;
                                        sortOrder?: "asc"
                                        | "desc";
                                        status?: unknown;
                                        templateIds?: (...)[];
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            ai_summarized_note: (...)
                                            | (...);
                                            created_at: DbDate;
                                            end_timestamp: DbDate;
                                            id: SessionId;
                                            private_note: (...) | (...);
                                            progress_status: (...) | (...) | (...) | (...) | (...) | (...);
                                            selected_template: (...) | (...);
                                            start_timestamp: DbDate;
                                            transcript: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            modifyAiNote: MutationProcedure<
                                {
                                    input: {
                                        customPrompt?: string;
                                        optionId: | "custom"
                                        | "shorten"
                                        | "lengthen"
                                        | "remove_name"
                                        | "remove_sensitive"
                                        | "regenerate";
                                        sessionId: string;
                                    };
                                    meta: object;
                                    output: { ai_generated_note: string };
                                },
                            >;
                            regenerateCodes: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: GenerateSessionCodesResult;
                                },
                            >;
                            switchTemplate: MutationProcedure<
                                {
                                    input: { sessionId: string; templateId: string };
                                    meta: object;
                                    output: RegenerateNoteResult;
                                },
                            >;
                            updateAiSummarizedNote: MutationProcedure<
                                {
                                    input: { aiSummarizedNote: string; id: string };
                                    meta: object;
                                    output:
                                        | {
                                            ai_summarized_note: (...)
                                            | (...);
                                            as_summarized_note_type: (...) | (...);
                                            audit_run_id: (...) | (...);
                                            audit_status:
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...);
                                            case_id: (...) | (...);
                                            cpt_code: (...) | (...);
                                            created_at: DbDate;
                                            created_by: (...) | (...);
                                            dsm_code: (...) | (...);
                                            end_timestamp: DbDate;
                                            error_msg: (...) | (...);
                                            file_url: (...) | (...);
                                            icd_code: (...) | (...);
                                            id: SessionId;
                                            manual_entry: (...) | (...) | (...);
                                            patient_id: (...) | (...);
                                            private_note: (...) | (...);
                                            progress_status: (...) | (...) | (...) | (...) | (...) | (...);
                                            selected_template: (...) | (...);
                                            start_timestamp: DbDate;
                                            transcript: (...) | (...);
                                            updated_by: (...) | (...);
                                        }
                                        | null;
                                },
                            >;
                            updateCodes: MutationProcedure<
                                {
                                    input: {
                                        codes: { code: ...; description: ...; status: ... }[];
                                        codeType: "icd" | "dsm";
                                        id: string;
                                    };
                                    meta: object;
                                    output: | { icd_code: (...)
                                    | (...); id: SessionId }
                                    | { dsm_code: (...) | (...); id: SessionId };
                                },
                            >;
                            updatePrivateNote: MutationProcedure<
                                {
                                    input: { id: string; privateNote: string };
                                    meta: object;
                                    output: {
                                        ai_summarized_note: string | null;
                                        as_summarized_note_type: string | null;
                                        audit_run_id: (...) & (...) | null;
                                        audit_status:
                                            | "error"
                                            | "pass"
                                            | "fail"
                                            | "needs_review"
                                            | "pending"
                                            | "in_progress"
                                            | "not_started"
                                            | null;
                                        case_id: (...) & (...)
                                        | null;
                                        cpt_code: (...)[] | null;
                                        created_at: DbDate;
                                        created_by: string | null;
                                        dsm_code: (...)[] | null;
                                        end_timestamp: DbDate;
                                        error_msg: string | null;
                                        file_url: string | null;
                                        icd_code: (...)[] | null;
                                        id: SessionId;
                                        manual_entry: boolean | null;
                                        patient_id: (...) & (...) | null;
                                        private_note: string | null;
                                        progress_status:
                                            | "initialized"
                                            | "processing"
                                            | "transcribing"
                                            | "complete"
                                            | "failed"
                                            | null;
                                        selected_template: | {
                                            additional_ai_instructions?: ...;
                                            check_cpt?: ...;
                                            check_demo?: ...;
                                            check_dsm_5?: ...;
                                            check_icd_10?: ...;
                                            created_by?: ...;
                                            created_by_circle?: ...;
                                            hidden_instructions?: ...;
                                            id: ...;
                                            is_allow_bullet_points?: ...;
                                            is_unstructured_narrative?: ...;
                                            last_updated?: ...;
                                            last_used?: ...;
                                            name?: ...;
                                            original_template_id?: ...;
                                            sections: ...;
                                            selected_audit_template_ids?: ...;
                                            shared_with_org_id?: ...;
                                            title: ...;
                                            [key: ...]: ...;
                                        }
                                        | null;
                                        start_timestamp: DbDate;
                                        transcript: string
                                        | null;
                                        updated_by: number | null;
                                    };
                                },
                            >;
                            updateSessionTime: MutationProcedure<
                                {
                                    input: {
                                        endTimestamp: string;
                                        id: string;
                                        startTimestamp: string;
                                    };
                                    meta: object;
                                    output: {
                                        ai_summarized_note: string
                                        | null;
                                        as_summarized_note_type: string | null;
                                        audit_run_id: (...) & (...) | null;
                                        audit_status:
                                            | "error"
                                            | "pass"
                                            | "fail"
                                            | "needs_review"
                                            | "pending"
                                            | "in_progress"
                                            | "not_started"
                                            | null;
                                        case_id: (...) & (...)
                                        | null;
                                        cpt_code: (...)[] | null;
                                        created_at: DbDate;
                                        created_by: string | null;
                                        dsm_code: (...)[] | null;
                                        end_timestamp: DbDate;
                                        error_msg: string | null;
                                        file_url: string | null;
                                        icd_code: (...)[] | null;
                                        id: SessionId;
                                        manual_entry: boolean | null;
                                        patient_id: (...) & (...) | null;
                                        private_note: string | null;
                                        progress_status:
                                            | "initialized"
                                            | "processing"
                                            | "transcribing"
                                            | "complete"
                                            | "failed"
                                            | null;
                                        selected_template: | {
                                            additional_ai_instructions?: ...;
                                            check_cpt?: ...;
                                            check_demo?: ...;
                                            check_dsm_5?: ...;
                                            check_icd_10?: ...;
                                            created_by?: ...;
                                            created_by_circle?: ...;
                                            hidden_instructions?: ...;
                                            id: ...;
                                            is_allow_bullet_points?: ...;
                                            is_unstructured_narrative?: ...;
                                            last_updated?: ...;
                                            last_used?: ...;
                                            name?: ...;
                                            original_template_id?: ...;
                                            sections: ...;
                                            selected_audit_template_ids?: ...;
                                            shared_with_org_id?: ...;
                                            title: ...;
                                            [key: ...]: ...;
                                        }
                                        | null;
                                        start_timestamp: DbDate;
                                        transcript: string
                                        | null;
                                        updated_by: number | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                profiles: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            listEmrProfiles: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sortBy?: "name"
                                        | "email";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            email: (...)
                                            | (...);
                                            external_system: (...) | (...) | (...) | (...) | (...);
                                            first_name: (...) | (...);
                                            id: ProfileId;
                                            last_name: (...) | (...);
                                            pending_invite_id: (...) | (...);
                                            title: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listInOrganization: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            first_name: (...)
                                            | (...);
                                            id: ProfileId;
                                            last_name: (...) | (...);
                                            title: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            updateProfile: MutationProcedure<
                                {
                                    input: { firstName: string; lastName: string; title?: string };
                                    meta: object;
                                    output: {
                                        clinic_size: string | null;
                                        created_at: string | null;
                                        customer_id: string | null;
                                        email: string | null;
                                        expectations: string | null;
                                        external_system:
                                            | "kipu"
                                            | "lightningstep"
                                            | "sunwave"
                                            | "qualifacts_insync"
                                            | null;
                                        external_system_id: string
                                        | null;
                                        first_name: string | null;
                                        hear_about_us: string | null;
                                        id: ProfileId;
                                        is_superadmin: boolean;
                                        last_name: string | null;
                                        last_updated: string | null;
                                        price_id: string | null;
                                        profile_type: "user" | "external";
                                        session_limit: string | null;
                                        subscription_status:
                                            | "trial_ended"
                                            | "trial_running"
                                            | "active"
                                            | "inactive"
                                            | null;
                                        title: string
                                        | null;
                                        user_id: (...) & (...) | null;
                                        vertical: string | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                reviewDashboard: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            bulkArchive: MutationProcedure<
                                {
                                    input: {
                                        auditTemplateIds?: (...)[];
                                        dateRange?: { from: ...; to: ... };
                                        includeNullTriggers?: boolean;
                                        patientIds?: (...)[];
                                        preview?: boolean;
                                        scoreRange?: { max?: ...; min?: ... };
                                        triggerIds?: (...)[];
                                    };
                                    meta: object;
                                    output: BulkArchiveAuditRunsOutput;
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: {
                                        admissionDateRange?: { from: ...; to: ... };
                                        admissionStatus?: "all" | "active" | "discharged";
                                        auditTemplateIds?: (...)[];
                                        authEndDateRange?: { from: ...; to: ... };
                                        authStartDateRange?: { from: ...; to: ... };
                                        clientSearch?: string;
                                        criteriaStatuses?: (...)[];
                                        cursor?: number;
                                        dateRange?: { from: ...; to: ... };
                                        facilityIds?: (...)[];
                                        facilityIdsForLoc?: (...)[];
                                        hasUnansweredManual?: boolean;
                                        includeNullTriggers?: boolean;
                                        levelOfCareIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        profileIds?: (...)[];
                                        scoreRange?: { max?: ...; min?: ... };
                                        sortBy?:
                                            | "created_at"
                                            | "type"
                                            | "trigger"
                                            | "admission_date"
                                            | "facility"
                                            | "provider_name"
                                            | "score"
                                            | "patient_name"
                                            | "level_of_care"
                                            | "assistant_name"
                                            | "auth_start_date"
                                            | "auth_end_date";
                                        sortOrder?: "asc"
                                        | "desc";
                                        triggerIds?: (...)[];
                                        type?: "chart_review" | "session_notes";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            admission_date: (...)
                                            | (...);
                                            audit_template_id: (...) | (...);
                                            audit_template_name: (...) | (...);
                                            auth_end_date: (...) | (...);
                                            auth_start_date: (...) | (...);
                                            case_id: (...) | (...);
                                            client_id: PatientId;
                                            client_name: string;
                                            criteria: (...)[];
                                            facility_name: string;
                                            level_of_care: (...) | (...);
                                            manual_pending_count: number;
                                            pass_count: number;
                                            provider_name: string;
                                            run_created_at: (...) | (...);
                                            run_id: (...) | (...);
                                            score_pct: number;
                                            total_count: number;
                                            total_rows: string;
                                            trigger: (...) | (...);
                                            type: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listGrouped: QueryProcedure<
                                {
                                    input: {
                                        admissionDateRange?: { from: ...; to: ... };
                                        admissionStatus?: "all" | "active" | "discharged";
                                        auditTemplateIds?: (...)[];
                                        authEndDateRange?: { from: ...; to: ... };
                                        authStartDateRange?: { from: ...; to: ... };
                                        clientSearch?: string;
                                        criteriaStatuses?: (...)[];
                                        cursor?: number;
                                        dateRange?: { from: ...; to: ... };
                                        facilityIds?: (...)[];
                                        facilityIdsForLoc?: (...)[];
                                        hasUnansweredManual?: boolean;
                                        includeNullTriggers?: boolean;
                                        levelOfCareIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        profileIds?: (...)[];
                                        scoreRange?: { max?: ...; min?: ... };
                                        sortBy?:
                                            | "created_at"
                                            | "type"
                                            | "trigger"
                                            | "admission_date"
                                            | "facility"
                                            | "provider_name"
                                            | "score"
                                            | "patient_name"
                                            | "level_of_care"
                                            | "assistant_name"
                                            | "auth_start_date"
                                            | "auth_end_date";
                                        sortOrder?: "asc"
                                        | "desc";
                                        triggerIds?: (...)[];
                                        type?: "chart_review" | "session_notes";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            admission_date: (...)
                                            | (...);
                                            audit_template_id: (...) | (...);
                                            audit_template_name: (...) | (...);
                                            auth_end_date: (...) | (...);
                                            auth_start_date: (...) | (...);
                                            case_id: (...) | (...);
                                            client_id: PatientId;
                                            client_name: string;
                                            criteria: (...)[];
                                            facility_name: string;
                                            level_of_care: (...) | (...);
                                            manual_pending_count: number;
                                            pass_count: number;
                                            provider_name: string;
                                            run_created_at: (...) | (...);
                                            run_id: (...) | (...);
                                            score_pct: number;
                                            total_count: number;
                                            total_rows: string;
                                            trigger: (...) | (...);
                                            type: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                        },
                    >,
                >;
                savedFilters: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: {
                                        columnVisibility?: Record<(...), (...)>;
                                        filters: {
                                            boolean?: (...) | (...);
                                            dateRange?: (...) | (...);
                                            range?: (...) | (...);
                                            select?: (...) | (...);
                                            text?: (...) | (...);
                                        };
                                        name: string;
                                        pageKey: string;
                                        viewMode?: "flat"
                                        | "grouped";
                                    };
                                    meta: object;
                                    output: SavedViewDto;
                                },
                            >;
                            delete: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: DeleteSavedFilterOutput;
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: { pageKey: string };
                                    meta: object;
                                    output: ListSavedFiltersOutput;
                                },
                            >;
                            rename: MutationProcedure<
                                {
                                    input: { id: string; name: string };
                                    meta: object;
                                    output: SavedViewDto;
                                },
                            >;
                            resolveLabels: QueryProcedure<
                                {
                                    input: {
                                        assistantIds?: (...)[];
                                        facilityIds?: (...)[];
                                        patientIds?: (...)[];
                                        providerIds?: (...)[];
                                        triggerIds?: (...)[];
                                    };
                                    meta: object;
                                    output: {
                                        assistantItems: { id: ...; name: ... }[];
                                        facilityItems: { id: ...; name: ... }[];
                                        patientItems: { id: ...; label: ... }[];
                                        providerItems: { id: ...; label: ... }[];
                                        triggerItems: { id: ...; name: ... }[];
                                    };
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        columnVisibility: Record<string, boolean>;
                                        filters: {
                                            boolean?: (...) | (...);
                                            dateRange?: (...) | (...);
                                            range?: (...) | (...);
                                            select?: (...) | (...);
                                            text?: (...) | (...);
                                        };
                                        id: string;
                                        viewMode: "flat"
                                        | "grouped";
                                    };
                                    meta: object;
                                    output: SavedViewDto;
                                },
                            >;
                        },
                    >,
                >;
                storage: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            uploadCredentials: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        accessToken: string;
                                        supabaseAnonKey: string;
                                        supabaseProjectRef: string;
                                        supabaseUrl: string;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                superadmin: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            impersonation: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        endImpersonation: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        getCurrentImpersonation: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        startImpersonation: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                            orgs: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        get: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        list: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        setArchived: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                            orgUsers: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        list: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        listRoles: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        updateRole: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                        },
                    >,
                >;
                teams: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            addTeamMembers: MutationProcedure<
                                {
                                    input: { profileIds: string[]; teamId: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        id: UserTeamId;
                                        profile_id: (...) & (...);
                                        team_id: (...) & (...);
                                        user_entity_id: (...) | (...);
                                        user_id: (...) | (...);
                                    }[];
                                },
                            >;
                            createTeam: MutationProcedure<
                                {
                                    input: { memberIds: string[]; name: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: string | null;
                                        entity_id: number | null;
                                        id: TeamId;
                                        name: string | null;
                                    };
                                },
                            >;
                            listTeams: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        created_at: string;
                                        id: TeamId;
                                        members: (...)[];
                                        name: (...) | (...);
                                    }[];
                                },
                            >;
                            removeTeamMember: MutationProcedure<
                                {
                                    input: { profileId: string; teamId: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        id: UserTeamId;
                                        profile_id: string & { __brand: ... };
                                        team_id: string & { __brand: ... };
                                        user_entity_id: number | null;
                                        user_id: (...) & (...) | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                templates: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: {
                                        additionalAiInstructions?: string;
                                        checkCpt?: boolean;
                                        checkDsm5?: boolean;
                                        checkIcd10?: boolean;
                                        hiddenInstructions?: string;
                                        isAllowBulletPoints?: boolean;
                                        isUnstructuredNarrative?: boolean;
                                        linkedAuditTemplateIds?: (...)[];
                                        sections?: (...)[];
                                        title: string;
                                    };
                                    meta: object;
                                    output: {
                                        additional_ai_instructions: string
                                        | null;
                                        check_cpt: boolean | null;
                                        check_demo: boolean | null;
                                        check_dsm_5: boolean | null;
                                        check_icd_10: boolean | null;
                                        created_by: (...) & (...) | null;
                                        created_by_circle: boolean | null;
                                        hidden_instructions: string | null;
                                        id: TemplateId;
                                        is_allow_bullet_points: boolean | null;
                                        is_unstructured_narrative: boolean | null;
                                        last_updated: DbDate | null;
                                        last_used: (...) & (...) | null;
                                        original_template_id: (...) & (...) | null;
                                        shared_with_org_id: (...) & (...) | null;
                                        title: string;
                                    };
                                },
                            >;
                            delete: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        additional_ai_instructions: string | null;
                                        check_cpt: boolean | null;
                                        check_demo: boolean | null;
                                        check_dsm_5: boolean | null;
                                        check_icd_10: boolean | null;
                                        created_by: (...) & (...) | null;
                                        created_by_circle: boolean | null;
                                        hidden_instructions: string | null;
                                        id: TemplateId;
                                        is_allow_bullet_points: boolean | null;
                                        is_unstructured_narrative: boolean | null;
                                        last_updated: DbDate | null;
                                        last_used: (...) & (...) | null;
                                        original_template_id: (...) & (...) | null;
                                        shared_with_org_id: (...) & (...) | null;
                                        title: string;
                                    };
                                },
                            >;
                            duplicate: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        additional_ai_instructions: string | null;
                                        check_cpt: boolean | null;
                                        check_demo: boolean | null;
                                        check_dsm_5: boolean | null;
                                        check_icd_10: boolean | null;
                                        created_by: (...) & (...) | null;
                                        created_by_circle: boolean | null;
                                        hidden_instructions: string | null;
                                        id: TemplateId;
                                        is_allow_bullet_points: boolean | null;
                                        is_unstructured_narrative: boolean | null;
                                        last_updated: DbDate | null;
                                        last_used: (...) & (...) | null;
                                        original_template_id: (...) & (...) | null;
                                        shared_with_org_id: (...) & (...) | null;
                                        title: string;
                                    };
                                },
                            >;
                            getById: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        linkedAuditTemplates: { id: ...; name: ... }[];
                                        sections: {
                                            body: ...;
                                            bullet_format: ...;
                                            created_by: ...;
                                            id: ...;
                                            last_updated: ...;
                                            name: ...;
                                            optional: ...;
                                            order: ...;
                                            template_id: ...;
                                        }[];
                                        template: {
                                            additional_ai_instructions: (...)
                                            | (...);
                                            check_cpt: (...) | (...) | (...);
                                            check_demo: (...) | (...) | (...);
                                            check_dsm_5: (...) | (...) | (...);
                                            check_icd_10: (...) | (...) | (...);
                                            created_by: (...) | (...);
                                            created_by_circle: (...) | (...) | (...);
                                            hidden_instructions: (...) | (...);
                                            id: TemplateId;
                                            is_allow_bullet_points: (...) | (...) | (...);
                                            is_unstructured_narrative: (...) | (...) | (...);
                                            last_updated: (...) | (...);
                                            last_used: (...) | (...);
                                            original_template_id: (...) | (...);
                                            shared_with_org_id: (...) | (...);
                                            title: string;
                                        };
                                    };
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sortBy?: "title"
                                        | "last_updated";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            check_cpt: (...)
                                            | (...)
                                            | (...);
                                            check_dsm_5: (...) | (...) | (...);
                                            check_icd_10: (...) | (...) | (...);
                                            created_by: (...) | (...);
                                            created_by_circle: (...) | (...) | (...);
                                            id: TemplateId;
                                            is_allow_bullet_points: (...) | (...) | (...);
                                            is_unstructured_narrative: (...) | (...) | (...);
                                            last_updated: (...) | (...);
                                            last_used: (...) | (...);
                                            original_template_id: (...) | (...);
                                            section_count: (...) | (...);
                                            shared_with_org_id: (...) | (...);
                                            title: string;
                                        },
                                    >;
                                },
                            >;
                            toggleSharing: MutationProcedure<
                                {
                                    input: { id: string; shared: boolean };
                                    meta: object;
                                    output: {
                                        additional_ai_instructions: string | null;
                                        check_cpt: boolean | null;
                                        check_demo: boolean | null;
                                        check_dsm_5: boolean | null;
                                        check_icd_10: boolean | null;
                                        created_by: (...) & (...) | null;
                                        created_by_circle: boolean | null;
                                        hidden_instructions: string | null;
                                        id: TemplateId;
                                        is_allow_bullet_points: boolean | null;
                                        is_unstructured_narrative: boolean | null;
                                        last_updated: DbDate | null;
                                        last_used: (...) & (...) | null;
                                        original_template_id: (...) & (...) | null;
                                        shared_with_org_id: (...) & (...) | null;
                                        title: string;
                                    };
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        additionalAiInstructions?: string
                                        | null;
                                        checkCpt?: boolean;
                                        checkDsm5?: boolean;
                                        checkIcd10?: boolean;
                                        hiddenInstructions?: string | null;
                                        id: string;
                                        isAllowBulletPoints?: boolean;
                                        isUnstructuredNarrative?: boolean;
                                        linkedAuditTemplateIds?: (...)[];
                                        sections?: (...)[];
                                        title?: string;
                                    };
                                    meta: object;
                                    output: {
                                        additional_ai_instructions: string
                                        | null;
                                        check_cpt: boolean | null;
                                        check_demo: boolean | null;
                                        check_dsm_5: boolean | null;
                                        check_icd_10: boolean | null;
                                        created_by: (...) & (...) | null;
                                        created_by_circle: boolean | null;
                                        hidden_instructions: string | null;
                                        id: TemplateId;
                                        is_allow_bullet_points: boolean | null;
                                        is_unstructured_narrative: boolean | null;
                                        last_updated: DbDate | null;
                                        last_used: (...) & (...) | null;
                                        original_template_id: (...) & (...) | null;
                                        shared_with_org_id: (...) & (...) | null;
                                        title: string;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                userPrompts: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: { prompt: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        id: UserPromptId;
                                        is_pinned: boolean | null;
                                        prompt: string | null;
                                        user_id: UserId | null;
                                    };
                                },
                            >;
                            delete: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        id: UserPromptId;
                                        is_pinned: boolean | null;
                                        prompt: string | null;
                                        user_id: UserId | null;
                                    };
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        id: UserPromptId;
                                        is_pinned: (...)
                                        | (...)
                                        | (...);
                                        prompt: (...) | (...);
                                        user_id: (...) | (...);
                                    }[];
                                },
                            >;
                            togglePin: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        id: UserPromptId;
                                        is_pinned: boolean | null;
                                        prompt: string | null;
                                        user_id: UserId | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
            },
        >,
    > = ...