Circle V2 API Docs
    Preparing search index...
    appRouter: BuiltRouter<
        {
            ctx: TRPCContext;
            errorShape: DefaultErrorShape;
            meta: object;
            transformer: false;
        },
        DecorateCreateRouterOptions<
            {
                actionItems: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            bulkApply: MutationProcedure<
                                {
                                    input: {
                                        assignee?: | { id: ...; type: ... }
                                        | { id: ...; type: ... }
                                        | null;
                                        items: {
                                            auditQuestionId: ...;
                                            auditResponseId: ...;
                                            auditRunId: ...;
                                            patientId: ...;
                                        }[];
                                        nextStep?: | "to_do"
                                        | "sent_to_clinician"
                                        | "resolved"
                                        | "no_action_needed"
                                        | "needs_clarification";
                                        status?: | "pass"
                                        | "fail"
                                        | "needs_review"
                                        | "not_applicable"
                                        | "missing"
                                        | "late"
                                        | "not_due_yet";
                                    };
                                    meta: object;
                                    output: void;
                                },
                            >;
                            getQuestionDetail: QueryProcedure<
                                {
                                    input: { responseId: string };
                                    meta: object;
                                    output: {
                                        assignee_id: ContactId | ProfileId | null;
                                        assignee_name: string | null;
                                        assignee_type: "contact" | "profile" | null;
                                        next_step:
                                            | "to_do"
                                            | "sent_to_clinician"
                                            | "resolved"
                                            | "no_action_needed"
                                            | "needs_clarification";
                                        reason: (...)[]
                                        | null;
                                        recommendation: string | null;
                                        response: string | null;
                                        response_id: AuditResponseId;
                                        short_form_response: string | null;
                                        status: string | null;
                                    };
                                },
                            >;
                            listAssignees: QueryProcedure<
                                {
                                    input: { search?: string };
                                    meta: object;
                                    output: ListAssigneesResult;
                                },
                            >;
                            listQuestions: QueryProcedure<
                                {
                                    input: {
                                        admissionStatus?: "active"
                                        | "all"
                                        | "discharged";
                                        assigneeContactIds?: (...)[];
                                        assigneeIds?: (...)[];
                                        auditTemplateIds?: (...)[];
                                        authEndDateRange?: { from: ...; to: ... };
                                        cursor?: number;
                                        facilityIds?: (...)[];
                                        facilityIdsForLoc?: (...)[];
                                        facilityIdsForProgram?: (...)[];
                                        facilityIdsForUrLoc?: (...)[];
                                        levelOfCareIds?: (...)[];
                                        limit?: number;
                                        nextSteps?: (...)[];
                                        offset?: number;
                                        programIds?: (...)[];
                                        providerIds?: (...)[];
                                        runDateRange?: { from: ...; to: ... };
                                        search?: string;
                                        sortBy:
                                            | "discharge"
                                            | "program_start"
                                            | "level_of_care"
                                            | "patient"
                                            | "facility"
                                            | "program"
                                            | "open_items"
                                            | "provider"
                                            | "ur_level_of_care"
                                            | "auth_end_date"
                                            | "admitted";
                                        sortOrder: "asc"
                                        | "desc";
                                        statuses: (
                                            (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                        )[];
                                        urLevelOfCareIds?: (...)[];
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            admission_date: (...)
                                            | (...);
                                            auth_end_date: (...) | (...);
                                            client_name: string;
                                            current_program: (...) | (...);
                                            episode_end_date: (...) | (...);
                                            facility_name: string;
                                            is_discharged: boolean;
                                            level_of_care: (...) | (...);
                                            mrn: (...) | (...);
                                            patient_id: PatientId;
                                            program_stay_start: (...) | (...);
                                            provider_name: string;
                                            questions: (...)[];
                                            total_rows: string;
                                            ur_level_of_care: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            updateActionItem: MutationProcedure<
                                {
                                    input: {
                                        assignee?: | { id: ...; type: ... }
                                        | { id: ...; type: ... }
                                        | null;
                                        auditQuestionId: string;
                                        nextStep?:
                                            | "to_do"
                                            | "sent_to_clinician"
                                            | "resolved"
                                            | "no_action_needed"
                                            | "needs_clarification";
                                        patientId: string;
                                    };
                                    meta: object;
                                    output: {
                                        assigned_contact_id: ContactId
                                        | null;
                                        assigned_to: ProfileId | null;
                                        audit_question_id: string & { __brand: ... };
                                        created_at: DbDate;
                                        id: PatientActionItemId;
                                        next_steps:
                                            | "to_do"
                                            | "sent_to_clinician"
                                            | "resolved"
                                            | "no_action_needed"
                                            | "needs_clarification";
                                        patient_id: string & { __brand: ... };
                                        updated_at: DbDate;
                                        updated_by: ProfileId | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                aiFeedback: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            listOwn: QueryProcedure<
                                {
                                    input: { patientId: string; targetRefs: string[] };
                                    meta: object;
                                    output: ListOwnAiFeedbackOutput;
                                },
                            >;
                            retract: MutationProcedure<
                                {
                                    input: { patientId: string; targetRef: string };
                                    meta: object;
                                    output: RetractAiFeedbackOutput;
                                },
                            >;
                            submit: MutationProcedure<
                                {
                                    input: {
                                        auditQuestionId?: string;
                                        auditResponseId?: string;
                                        auditRunId?: string;
                                        comment?: string;
                                        conversationId?: string;
                                        correction?: string;
                                        flow: | "case_chat"
                                        | "chart_review"
                                        | "note_generation"
                                        | "note_validation";
                                        messageId?: string;
                                        patientId: string;
                                        patientSessionId?: string;
                                        rating: "thumbs_up"
                                        | "thumbs_down";
                                        targetRef: string;
                                        targetSnapshot?: string;
                                        threadSnapshot?: (...)[];
                                    };
                                    meta: object;
                                    output: SubmitAiFeedbackOutput;
                                },
                            >;
                        },
                    >,
                >;
                auditRuns: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            archive: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: { archived: boolean };
                                },
                            >;
                            createResponseTrail: MutationProcedure<
                                {
                                    input: | {
                                        auditResponseId: string;
                                        comment?: (...)
                                        | (...);
                                        kind: "existing";
                                        markedAs:
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                        response?: (...) | (...);
                                    }
                                    | {
                                        auditQuestionId: string;
                                        auditRunId: string;
                                        comment?: (...)
                                        | (...);
                                        kind: "manual";
                                        markedAs:
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                        response?: (...) | (...);
                                    };
                                    meta: object;
                                    output: {
                                        audit_response_id: string & { __brand: ... };
                                        comment: string | null;
                                        created_at: DbDate;
                                        created_by: (...) & (...) | null;
                                        id: AuditResponseTrailId;
                                        marked_as:
                                            | "pass"
                                            | "fail"
                                            | "needs_review"
                                            | "not_applicable"
                                            | "missing"
                                            | "late"
                                            | "not_due_yet"
                                            | "summary_entered";
                                        response: string
                                        | null;
                                    };
                                },
                            >;
                            getById: QueryProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        auditRun: {
                                            archived: boolean;
                                            audit_template_id: (...) | (...);
                                            case_id: (...) | (...);
                                            created_at: DbDate;
                                            created_by: (...) | (...);
                                            entity_id: (...) | (...);
                                            hidden: boolean;
                                            id: AuditRunId;
                                            patient_first_name: (...) | (...);
                                            patient_id: (...) | (...);
                                            patient_last_name: (...) | (...);
                                            ran_against_charts_at: (...) | (...);
                                            run_context: (...) | (...);
                                            session_id: (...) | (...);
                                            status: (...) | (...);
                                            summary: (...) | (...);
                                            template_name: (...) | (...);
                                            treatment_episode_id: (...) | (...);
                                            trigger: (...) | (...);
                                            triggered_at: (...) | (...);
                                        };
                                        documentWait: | {
                                            outcome: ...;
                                            parkedAt: ...;
                                            releasedAt: ...;
                                            unreadChartIds: ...;
                                        }
                                        | null;
                                        hasPendingResponses: boolean;
                                        isWaitingForDocuments: boolean;
                                        lastSync: ResolveAuditRunSyncServiceResult;
                                        responses: LegacyAuditRunResponseViewModel[];
                                        scopedCharts: (...)[]
                                        | null;
                                        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>;
                                },
                            >;
                            listQuestionRunHistory: QueryProcedure<
                                {
                                    input: {
                                        auditQuestionId: string;
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        patientId: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            auditRunId: AuditRunId;
                                            runCreatedAt: DbDate;
                                            sessionId: (...)
                                            | (...);
                                            status: (...) | (...);
                                            triggerName: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listRecentForPatient: QueryProcedure<
                                {
                                    input: {
                                        patientId: string;
                                        treatmentEpisodeId?: string;
                                        type?: "chart_review"
                                        | "session_notes";
                                    };
                                    meta: object;
                                    output: ListRecentPatientReviewRunsServiceResult;
                                },
                            >;
                            rerunQuestion: MutationProcedure<
                                {
                                    input: {
                                        auditQuestionId: string;
                                        auditRunId: string;
                                        questionText?: string;
                                    };
                                    meta: object;
                                    output: { auditRunId: AuditRunId };
                                },
                            >;
                        },
                    >,
                >;
                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;
                                        deleted: boolean;
                                        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;
                                        deleted: boolean;
                                        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;
                                        deleted: boolean;
                                        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: (...) | (...);
                                            deleted: boolean;
                                            description: (...) | (...);
                                            id: AuditTemplateId;
                                            name: (...) | (...);
                                            org_id: (...) | (...);
                                            share_with_org: (...) | (...) | (...);
                                            shared_by: (...) | (...);
                                            shared_with_entity_id: (...) | (...);
                                            updated_at: (...) | (...);
                                        };
                                        questions: {
                                            additional_instructions: ...;
                                            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;
                                        deletedOnly?: boolean;
                                        includeDeleted?: boolean;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sortBy?: "name"
                                        | "created_at"
                                        | "last_edited_at";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            created_at: DbDate;
                                            created_by: (...)
                                            | (...);
                                            custom_review_criteria_prompt: (...) | (...);
                                            custom_summary_prompt: (...) | (...);
                                            description: (...) | (...);
                                            id: AuditTemplateId;
                                            last_edited_at: DbDate;
                                            name: (...) | (...);
                                            org_id: (...) | (...);
                                            question_count: (...) | (...);
                                            share_with_org: (...) | (...) | (...);
                                            triggers: (...)[];
                                        },
                                    >;
                                },
                            >;
                            restore: MutationProcedure<
                                {
                                    input: { id: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: (...) & (...) | null;
                                        custom_review_criteria_prompt: string | null;
                                        custom_summary_prompt: string | null;
                                        deleted: boolean;
                                        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;
                                    };
                                },
                            >;
                            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;
                                        deleted: boolean;
                                        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;
                                        deleted: boolean;
                                        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;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                census: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            facility: QueryProcedure<
                                {
                                    input: { facilityId: string };
                                    meta: object;
                                    output: {
                                        asOf: string;
                                        facility: {
                                            id: FacilityId;
                                            lastSyncedAt: (...) | (...);
                                            name: string;
                                            timezone: (...) | (...);
                                        };
                                        programs: {
                                            activeMembers: ...;
                                            adolescent: ...;
                                            adult: ...;
                                            facilityProgramId: ...;
                                            name: ...;
                                            unknownAge: ...;
                                        }[];
                                        totals: {
                                            activeMembers: number;
                                            adolescent: number;
                                            adult: number;
                                            unknownAge: number;
                                        };
                                    };
                                },
                            >;
                            listFacilities: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        activeMembers: number;
                                        ageBands: { adolescent: number; adult: number; unknown: number };
                                        asOf: string | null;
                                        facilities: {
                                            activeMembers: ...;
                                            adolescent: ...;
                                            adult: ...;
                                            facilityId: ...;
                                            lastSyncedAt: ...;
                                            name: ...;
                                            timezone: ...;
                                            unknownAge: ...;
                                        }[];
                                    };
                                },
                            >;
                            programMembers: QueryProcedure<
                                {
                                    input: { facilityId: string; facilityProgramId: string
                                    | null };
                                    meta: object;
                                    output: {
                                        asOf: string;
                                        facility: {
                                            id: FacilityId;
                                            lastSyncedAt: (...) | (...);
                                            name: string;
                                            timezone: (...) | (...);
                                        };
                                        members: {
                                            ageBand: ...;
                                            clinicianName: ...;
                                            clinicianShortName: ...;
                                            dayInCare: ...;
                                            displayName: ...;
                                            patientId: ...;
                                            payerName: ...;
                                            programName: ...;
                                            treatmentEpisodeId: ...;
                                        }[];
                                        program: { id: (...)
                                        | (...); name: string };
                                    };
                                },
                            >;
                        },
                    >,
                >;
                chartReview: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            releaseParkedRun: MutationProcedure<
                                {
                                    input: { auditRunId: string };
                                    meta: object;
                                    output: { released: boolean };
                                },
                            >;
                            run: MutationProcedure<
                                {
                                    input: {
                                        auditSource?: "manual"
                                        | "queue"
                                        | "api";
                                        patientChartIds?: (...)[];
                                        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<
                        {
                            check: MutationProcedure<
                                {
                                    input: { patientId?: string
                                    | null; triggerId?: string | null };
                                    meta: object;
                                    output: CheckTriggersForEntityResult;
                                },
                            >;
                            create: MutationProcedure<
                                {
                                    input: {
                                        auditTemplateIds: string[];
                                        clinicalLevelsOfCare?: (...)[];
                                        facilities?: (...)[];
                                        intervalSeconds: number | null;
                                        name: string;
                                        programs?: (...)[];
                                        schedule?: { schedule: ...; timezone: ... } | null;
                                        timeAfterTriggerSeconds: number;
                                        triggerType:
                                            | "admission"
                                            | "discharge"
                                            | "projected_discharge"
                                            | "utilization_end"
                                            | "program_start";
                                        urLevelsOfCare?: (...)[];
                                    };
                                    meta: object;
                                    output: {
                                        audit_template_id: AuditTemplateId
                                        | null;
                                        audit_templates: TriggerAuditTemplate[];
                                        created_at: DbDate;
                                        deleted: boolean;
                                        enabled: boolean;
                                        entity_id: number & { __brand: ... };
                                        filters:
                                            | {
                                                clinical_levels_of_care: ...;
                                                facilities: ...;
                                                level_of_care_ids: ...;
                                                programs: ...;
                                                ur_levels_of_care: ...;
                                            }
                                            | 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"
                                            | "projected_discharge"
                                            | "utilization_end"
                                            | "program_start";
                                        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:
                                            | {
                                                clinical_levels_of_care: ...;
                                                facilities: ...;
                                                level_of_care_ids: ...;
                                                programs: ...;
                                                ur_levels_of_care: ...;
                                            }
                                            | 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"
                                            | "projected_discharge"
                                            | "utilization_end"
                                            | "program_start";
                                        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: (...) & (...);
                                        filters_display: {
                                            facilities: ...;
                                            filter_type: ...;
                                            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[];
                                        clinicalLevelsOfCare?: (...)[];
                                        facilities?: (...)[];
                                        id: string;
                                        intervalSeconds: number | null;
                                        name: string;
                                        programs?: (...)[];
                                        schedule?: { schedule: ...; timezone: ... } | null;
                                        timeAfterTriggerSeconds: number;
                                        urLevelsOfCare?: (...)[];
                                    };
                                    meta: object;
                                    output: {
                                        audit_template_id: AuditTemplateId
                                        | null;
                                        audit_templates: TriggerAuditTemplate[];
                                        created_at: DbDate;
                                        deleted: boolean;
                                        enabled: boolean;
                                        entity_id: number & { __brand: ... };
                                        filters:
                                            | {
                                                clinical_levels_of_care: ...;
                                                facilities: ...;
                                                level_of_care_ids: ...;
                                                programs: ...;
                                                ur_levels_of_care: ...;
                                            }
                                            | 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"
                                            | "projected_discharge"
                                            | "utilization_end"
                                            | "program_start";
                                        updated_at: DbDate;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                chat: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            sendMessage: MutationProcedure<
                                {
                                    input: {
                                        conversationId?: string;
                                        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;
                                },
                            >;
                        },
                    >,
                >;
                dictionary: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            createConcept: MutationProcedure<
                                {
                                    input: {
                                        name: string;
                                        subject: "document"
                                        | "level_of_care"
                                        | "credential";
                                    };
                                    meta: object;
                                    output: { id: DictionaryConceptId; name: string };
                                },
                            >;
                            listChartTitleLocations: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        patientSearch?: string;
                                        title: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            documents: number;
                                            facilityName: string;
                                            patientFirstName: (...)
                                            | (...);
                                            patientId: PatientId;
                                            patientLastName: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listChartTitlePatterns: QueryProcedure<
                                {
                                    input: {
                                        conceptIds?: (...)[];
                                        cursor?: number;
                                        facilityIds?: (...)[];
                                        includeMapped: boolean;
                                        kind?: "pattern" | "exactTitle";
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sort?: "title" | "mostSeen" | "mapsTo";
                                        sortOrder?: "asc" | "desc";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            documents: number;
                                            isMapped: boolean;
                                            kind: ChartTitleKind;
                                            label: string;
                                            mapsTo: (...)[];
                                            parts: (...)[];
                                            patternId: ChartTitlePatternId;
                                            titleCount: number;
                                            titles: (...)[];
                                        },
                                    >;
                                },
                            >;
                            listChartTitlePatternTitles: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        patternId: string;
                                        titleSearch?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            documents: number;
                                            facilities: number;
                                            mappedDocuments: number;
                                            patients: number;
                                            title: string;
                                        },
                                    >;
                                },
                            >;
                            listConcepts: QueryProcedure<
                                {
                                    input: { subject: "document"
                                    | "level_of_care"
                                    | "credential" };
                                    meta: object;
                                    output: {
                                        id: DictionaryConceptId;
                                        name: string;
                                        updated_at: DbDate;
                                    }[];
                                },
                            >;
                            listConceptsWithRules: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                        sort?: "name"
                                        | "updated";
                                        sortOrder?: "asc" | "desc";
                                        subject: "document" | "level_of_care" | "credential";
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            conceptId: DictionaryConceptId;
                                            name: string;
                                            rules: (...)[];
                                            updatedAt: DbDate;
                                        },
                                    >;
                                },
                            >;
                            listConceptTitleRules: QueryProcedure<
                                {
                                    input: { conceptId: string };
                                    meta: object;
                                    output: ConceptTitleRules;
                                },
                            >;
                            listCredentialEntries: QueryProcedure<
                                {
                                    input: { search?: string };
                                    meta: object;
                                    output: {
                                        conceptId: DictionaryConceptId;
                                        matchers: (...)[];
                                        name: string;
                                        staffCount: number;
                                        updatedAt: DbDate;
                                    }[];
                                },
                            >;
                            listCredentialEntriesPage: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            conceptId: DictionaryConceptId;
                                            matchers: (...)[];
                                            name: string;
                                            staffCount: number;
                                            updatedAt: DbDate;
                                        },
                                    >;
                                },
                            >;
                            listCredentialProviders: QueryProcedure<
                                {
                                    input: {
                                        credential: string;
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        providerSearch?: string;
                                    };
                                    meta: object;
                                    output: {
                                        items: { facilityName: ...; firstName: ...; lastName: ... }[];
                                        nextCursor: number | null;
                                        summary: { facilities: number; providers: number };
                                        total: number;
                                    };
                                },
                            >;
                            listCredentials: QueryProcedure<
                                {
                                    input: { includeMapped: boolean; search?: string };
                                    meta: object;
                                    output: {
                                        credential: string;
                                        entries: (...)[];
                                        providerCount: number;
                                    }[];
                                },
                            >;
                            listCredentialsPage: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        includeMapped: boolean;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        { credential: string; entries: (...)[]; providerCount: number },
                                    >;
                                },
                            >;
                            listLevelOfCareEntries: QueryProcedure<
                                {
                                    input: { search?: string };
                                    meta: object;
                                    output: {
                                        conceptId: DictionaryConceptId;
                                        matchers: (...)[];
                                        name: string;
                                        updatedAt: DbDate;
                                    }[];
                                },
                            >;
                            listUnmappedLevelOfCareNames: QueryProcedure<
                                {
                                    input: { search?: string };
                                    meta: object;
                                    output: UnmappedLevelOfCareName[];
                                },
                            >;
                            mapChartTitlesToConcept: MutationProcedure<
                                {
                                    input: {
                                        conceptId: string;
                                        exactTitles: string[];
                                        patterns: (...)[][];
                                    };
                                    meta: object;
                                    output: { taggingError: string
                                    | null };
                                },
                            >;
                            mapCredentials: MutationProcedure<
                                {
                                    input: { conceptId: string; credentials: string[] };
                                    meta: object;
                                    output: void;
                                },
                            >;
                            mapLevelOfCareNames: MutationProcedure<
                                {
                                    input: {
                                        conceptId: string;
                                        levelOfCareIds: string[];
                                        programIds: string[];
                                    };
                                    meta: object;
                                    output: void;
                                },
                            >;
                            saveCircleMatchers: MutationProcedure<
                                {
                                    input: {
                                        conceptId: string;
                                        matchers: { externalDocumentType: ...; externalFormId: ... }[];
                                    };
                                    meta: object;
                                    output: { taggingError: string
                                    | null };
                                },
                            >;
                            saveConceptExactTitles: MutationProcedure<
                                {
                                    input: { conceptId: string; titles: string[] };
                                    meta: object;
                                    output: { taggingError: string | null };
                                },
                            >;
                            unmapCredentials: MutationProcedure<
                                {
                                    input: { conceptId: string; matcherIds: string[] };
                                    meta: object;
                                    output: void;
                                },
                            >;
                            unmapLevelOfCareNames: MutationProcedure<
                                {
                                    input: { conceptId: string; matcherIds: string[] };
                                    meta: object;
                                    output: void;
                                },
                            >;
                            unmapTitlePattern: MutationProcedure<
                                {
                                    input: { conceptId: string; ruleId: string };
                                    meta: object;
                                    output: { taggingError: string | null };
                                },
                            >;
                        },
                    >,
                >;
                facilities: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: {
                                        integration?: | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... };
                                        name: string;
                                        timezone: string;
                                    };
                                    meta: object;
                                    output: | {
                                        admission_start_source: (...)
                                        | (...)
                                        | (...);
                                        created_at: DbDate;
                                        entity_id: (...) & (...);
                                        id: FacilityId;
                                        name: string;
                                        timezone: (...) | (...);
                                        updated_at: DbDate;
                                    }
                                    | {
                                        facility: {
                                            admission_start_source: ...;
                                            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 };
                                },
                            >;
                            hasEmrIntegratedFacilities: QueryProcedure<
                                { input: void; meta: object; output: boolean },
                            >;
                            listInOrganization: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<{ id: FacilityId; name: string }>;
                                },
                            >;
                            listWithFilterOptions: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        facility_levels_of_care: (...)[];
                                        id: FacilityId;
                                        levels_of_care: (...)[];
                                        name: string;
                                        programs: (...)[];
                                    }[];
                                },
                            >;
                            listWithIntegrations: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: {
                                        admission_start_source: (...)
                                        | (...)
                                        | (...);
                                        created_at: DbDate;
                                        id: FacilityId;
                                        integration_credentials:
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                        integration_id: (...) | (...);
                                        integration_label: (...) | (...);
                                        integration_status: (...) | (...) | (...) | (...);
                                        integration_type:
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                        last_sync: (...) | (...);
                                        name: string;
                                        timezone: (...) | (...);
                                    }[];
                                },
                            >;
                            listWithIntegrationsPage: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        limit?: number;
                                        offset?: number;
                                        search?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            admission_start_source: (...)
                                            | (...)
                                            | (...);
                                            created_at: DbDate;
                                            id: FacilityId;
                                            integration_credentials:
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...);
                                            integration_id: (...) | (...);
                                            integration_label: (...) | (...);
                                            integration_status: (...) | (...) | (...) | (...);
                                            integration_type:
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...);
                                            last_sync: (...) | (...);
                                            name: string;
                                            timezone: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listWithLevelsOfCare: QueryProcedure<
                                { input: void; meta: object; output: FacilityWithLevelsOfCare[] },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        admissionStartSource?: | "episode_start_date"
                                        | "first_program_start"
                                        | null;
                                        id: string;
                                        integration?: | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... }
                                        | { credentials: ...; type: ... };
                                        name: string;
                                        timezone?: string;
                                    };
                                    meta: object;
                                    output: UpdateFacilityWithIntegrationResult;
                                },
                            >;
                        },
                    >,
                >;
                formRuns: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            deleteDocument: MutationProcedure<
                                {
                                    input: { runId: string };
                                    meta: object;
                                    output: { deleted: boolean; runId: FormRunId };
                                },
                            >;
                            download: QueryProcedure<
                                {
                                    input: { runId: string };
                                    meta: object;
                                    output: {
                                        expiresInSeconds: number;
                                        fileName: string | null;
                                        isStale: boolean;
                                        patientChartId: PatientChartId;
                                        runId: FormRunId;
                                        signedUrl: string;
                                    };
                                },
                            >;
                            getAnswers: QueryProcedure<
                                {
                                    input: { runId: string };
                                    meta: object;
                                    output: {
                                        answers: {
                                            annotationId: ...;
                                            annotationPrompt: ...;
                                            annotationType: ...;
                                            answerId: ...;
                                            canRevertToAiAnswer: ...;
                                            citations: ...;
                                            contactLink: ...;
                                            contextSources: ...;
                                            coordinates: ...;
                                            coordinatesSource: ...;
                                            createdAt: ...;
                                            fieldStatus: ...;
                                            fontSize: ...;
                                            generatedByAi: ...;
                                            isExclusive: ...;
                                            noAnswerReason: ...;
                                            status: ...;
                                            subfieldProgress: ...;
                                            updatedAt: ...;
                                            value: ...;
                                        }[];
                                        formId: string & { __brand: ... };
                                        isTerminal: boolean;
                                        runId: FormRunId;
                                        status: string;
                                    };
                                },
                            >;
                            getRetrievalScope: QueryProcedure<
                                {
                                    input: { runId: string };
                                    meta: object;
                                    output: {
                                        runId: FormRunId;
                                        scope:
                                            | {
                                                includeEmr: ...;
                                                selectedDocumentIds: ...;
                                                selectedSessionIds: ...;
                                            }
                                            | null;
                                    };
                                },
                            >;
                            getStatus: QueryProcedure<
                                {
                                    input: { runId: string };
                                    meta: object;
                                    output: {
                                        createdAt: DbDate | null;
                                        errorMsg: string | null;
                                        finishedAt: (...) & (...) | null;
                                        formId: string & { __brand: ... };
                                        isTerminal: boolean;
                                        patientId: (...) & (...) | null;
                                        progress: FormRunProgress;
                                        runId: FormRunId;
                                        status: string;
                                        totalFieldsSource: TotalFieldsSource;
                                    };
                                },
                            >;
                            getTemplateUrl: QueryProcedure<
                                {
                                    input: { runId: string };
                                    meta: object;
                                    output:
                                        | { expiresInSeconds: null; runId: FormRunId; signedUrl: null }
                                        | { expiresInSeconds: number; runId: FormRunId; signedUrl: string };
                                },
                            >;
                            listForms: QueryProcedure<
                                {
                                    input: void;
                                    meta: object;
                                    output: {
                                        items: {
                                            annotationCount: ...;
                                            context: ...;
                                            createdAt: ...;
                                            createdBy: ...;
                                            defaultFontSize: ...;
                                            fileName: ...;
                                            fileUrl: ...;
                                            id: ...;
                                            orgId: ...;
                                            requiredContactTypes: ...;
                                            shareWithOrg: ...;
                                            updatedAt: ...;
                                        }[];
                                    };
                                },
                            >;
                            refreshDocument: MutationProcedure<
                                {
                                    input: { runId: string };
                                    meta: object;
                                    output: { document: EditedDocumentState; runId: FormRunId };
                                },
                            >;
                            rerun: MutationProcedure<
                                {
                                    input: {
                                        chosenContacts?: Record<(...), (...)>;
                                        includeEmr?: boolean;
                                        runId: string;
                                        selectedDocumentIds?: (...)[];
                                        selectedSessionIds?: (...)[];
                                        treatmentEpisodeId?: string;
                                    };
                                    meta: object;
                                    output: {
                                        patientChartId: PatientChartId;
                                        previousRunId: FormRunId;
                                        runId: FormRunId;
                                        status: "queued";
                                    };
                                },
                            >;
                            revertAnswer: MutationProcedure<
                                {
                                    input: {
                                        annotationId: string;
                                        deferRender?: boolean;
                                        runId: string;
                                    };
                                    meta: object;
                                    output: {
                                        answer: {
                                            annotationId: string;
                                            annotationPrompt: (...)
                                            | (...);
                                            annotationType: (...) | (...) | (...) | (...);
                                            answerId: string;
                                            canRevertToAiAnswer: boolean;
                                            citations: unknown;
                                            contactLink: (...) | (...);
                                            contextSources: (...)[];
                                            coordinates: (...)[];
                                            coordinatesSource: CoordinateSource;
                                            createdAt: (...) | (...);
                                            fieldStatus: FormRunFieldStatus;
                                            fontSize: (...) | (...);
                                            generatedByAi: (...) | (...) | (...);
                                            isExclusive: (...) | (...) | (...);
                                            noAnswerReason: (...) | (...);
                                            status: (...) | (...);
                                            subfieldProgress: (...) | (...);
                                            updatedAt: (...) | (...);
                                            value: DecodedAnswerValue;
                                        };
                                        document: EditedDocumentState;
                                        runId: FormRunId;
                                    };
                                },
                            >;
                            start: MutationProcedure<
                                {
                                    input: {
                                        chosenContacts?: Record<(...), (...)>;
                                        formId: string;
                                        includeEmr?: boolean;
                                        patientId: string;
                                        selectedDocumentIds?: (...)[];
                                        selectedSessionIds?: (...)[];
                                        treatmentEpisodeId?: string;
                                    };
                                    meta: object;
                                    output: {
                                        patientChartId: PatientChartId;
                                        runId: FormRunId;
                                        status: "queued";
                                    };
                                },
                            >;
                            updateAnswer: MutationProcedure<
                                {
                                    input: {
                                        annotationId: string;
                                        deferRender?: boolean;
                                        fontSize?: number
                                        | null;
                                        runId: string;
                                        value:
                                            | { kind: ...; values: ... }
                                            | { kind: ...; subfields: ... }
                                            | { kind: ... };
                                    };
                                    meta: object;
                                    output: {
                                        answer: {
                                            annotationId: string;
                                            annotationPrompt: (...)
                                            | (...);
                                            annotationType: (...) | (...) | (...) | (...);
                                            answerId: string;
                                            canRevertToAiAnswer: boolean;
                                            citations: unknown;
                                            contactLink: (...) | (...);
                                            contextSources: (...)[];
                                            coordinates: (...)[];
                                            coordinatesSource: CoordinateSource;
                                            createdAt: (...) | (...);
                                            fieldStatus: FormRunFieldStatus;
                                            fontSize: (...) | (...);
                                            generatedByAi: (...) | (...) | (...);
                                            isExclusive: (...) | (...) | (...);
                                            noAnswerReason: (...) | (...);
                                            status: (...) | (...);
                                            subfieldProgress: (...) | (...);
                                            updatedAt: (...) | (...);
                                            value: DecodedAnswerValue;
                                        };
                                        document: EditedDocumentState;
                                        runId: FormRunId;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                formTemplates: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: { fileName: string; storageKey: string };
                                    meta: object;
                                    output: { id: FormId };
                                },
                            >;
                            createUploadTarget: MutationProcedure<
                                {
                                    input: { fileName: string; sizeBytes: number };
                                    meta: object;
                                    output: { bucket: string; config: StorageCredentials; key: string };
                                },
                            >;
                            delete: MutationProcedure<
                                {
                                    input: { formId: string };
                                    meta: object;
                                    output: { id: FormId };
                                },
                            >;
                            detect: MutationProcedure<
                                {
                                    input: { formId: string };
                                    meta: object;
                                    output: TemplateDetection;
                                },
                            >;
                            detectWithExtend: MutationProcedure<
                                {
                                    input: { formId: string };
                                    meta: object;
                                    output: { runId: string };
                                },
                            >;
                            get: QueryProcedure<
                                {
                                    input: { formId: string };
                                    meta: object;
                                    output: {
                                        annotationCount: number;
                                        context: string | null;
                                        createdAt: DbDate;
                                        createdBy: UserId | null;
                                        defaultFontSize: string | null;
                                        fileName: string | null;
                                        fileUrl: string | null;
                                        id: FormId;
                                        orgId: (...) & (...) | null;
                                        requiredContactTypes: FormTemplateRequiredContactType[];
                                        shareWithOrg: boolean;
                                        updatedAt: DbDate | null;
                                    };
                                },
                            >;
                            getDetection: QueryProcedure<
                                {
                                    input: { formId: string };
                                    meta: object;
                                    output: TemplateDetection;
                                },
                            >;
                            getDocument: QueryProcedure<
                                {
                                    input: { formId: string };
                                    meta: object;
                                    output: { documentUrl: string };
                                },
                            >;
                            getExtendDetection: QueryProcedure<
                                {
                                    input: { formId: string; runId: string };
                                    meta: object;
                                    output: ExtendDetectionState;
                                },
                            >;
                            getFields: QueryProcedure<
                                {
                                    input: { formId: string };
                                    meta: object;
                                    output: {
                                        conditionalRules: {
                                            description: ...;
                                            id: ...;
                                            kind: ...;
                                            sourceAnnotationId: ...;
                                            targetAnnotationId: ...;
                                        }[];
                                        fields: FormTemplateField[];
                                        formId: FormId;
                                        requiredContactTypes: FormTemplateRequiredContactType[];
                                    };
                                },
                            >;
                            list: QueryProcedure<
                                {
                                    input: { cursor?: number; limit?: number; offset?: number };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            annotationCount: number;
                                            context: (...)
                                            | (...);
                                            createdAt: DbDate;
                                            createdBy: (...) | (...);
                                            defaultFontSize: (...) | (...);
                                            fileName: (...) | (...);
                                            fileUrl: (...) | (...);
                                            id: FormId;
                                            orgId: (...) | (...);
                                            permissions: FormTemplateRowPermissions;
                                            requiredContactTypes: (...)[];
                                            shareWithOrg: boolean;
                                            updatedAt: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            rename: MutationProcedure<
                                {
                                    input: { fileName: string; formId: string };
                                    meta: object;
                                    output: { fileName: string | null; id: FormId };
                                },
                            >;
                            setOrgSharing: MutationProcedure<
                                {
                                    input: { formId: string; shareWithOrg: boolean };
                                    meta: object;
                                    output: { id: FormId; shareWithOrg: boolean };
                                },
                            >;
                            testFill: MutationProcedure<
                                {
                                    input: {
                                        annotationIds?: (...)[];
                                        chosenContacts?: Record<(...), (...)>;
                                        formId: string;
                                        includeEmr?: boolean;
                                        maxAiFields?: number;
                                        patientId: string;
                                        renderAnswers?: (...)[];
                                        renderPdf?: boolean;
                                        selectedDocumentIds?: (...)[];
                                        selectedSessionIds?: (...)[];
                                        treatmentEpisodeId?: string;
                                    };
                                    meta: object;
                                    output: {
                                        aiFieldCount: number;
                                        aiFieldIds: string[];
                                        aiFieldsAnswered: number;
                                        chunkSize: number;
                                        degradations: DegradationSummaryEntry[];
                                        deterministicAnswerCount: number;
                                        fields: DryRunFormFillField[];
                                        formId: FormId;
                                        patientId: PatientId;
                                        pdf: { byteLength: ...; dataUrl: ...; fileName: ... }
                                        | null;
                                        pdfOmittedReason: "too_large" | "not_requested" | null;
                                        skippedFieldIds: string[];
                                        truncated: boolean;
                                        undrawnCount: number;
                                        unpositionedCount: number;
                                    };
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        annotations: {
                                            contactLink?: ...;
                                            coordinates: ...;
                                            generatedByAi?: ...;
                                            id?: ...;
                                            isExclusive?: ...;
                                            prompt: ...;
                                            type: ...;
                                        }[];
                                        context?: string
                                        | null;
                                        defaultFontSize?: number | null;
                                        formId: string;
                                    };
                                    meta: object;
                                    output: SavedTemplate;
                                },
                            >;
                            updateConditionalRules: MutationProcedure<
                                {
                                    input: {
                                        formId: string;
                                        rules: {
                                            description: ...;
                                            id: ...;
                                            kind: ...;
                                            sourceAnnotationId: ...;
                                            targetAnnotationId: ...;
                                        }[];
                                    };
                                    meta: object;
                                    output: {
                                        formId: FormId;
                                        rules: {
                                            description: ...;
                                            id: ...;
                                            kind: ...;
                                            sourceAnnotationId: ...;
                                            targetAnnotationId: ...;
                                        }[];
                                    };
                                },
                            >;
                        },
                    >,
                >;
                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" }
                                    | {
                                        credentials: { as_of_date?: ...; seed: ... };
                                        type: "synthetic";
                                    };
                                    meta: object;
                                    output: | FetchLightningStepLocationsResult
                                    | FetchKipuLocationsResult
                                    | FetchSyntheticLocationsResult;
                                },
                            >;
                            getPatientRunRecording: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: { url: string | null };
                                },
                            >;
                            getPatientSyncStatus: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: PatientSyncStatus | null;
                                },
                            >;
                            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: SyncPatientEpisodesServiceResult
                                    | { success: true };
                                },
                            >;
                            syncPatientEpisodes: MutationProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: DefaultValue<TOutputOut, $Output>;
                                },
                            >;
                            update: MutationProcedure<
                                {
                                    input: {
                                        credentials?: | {
                                            app_id: ...;
                                            extend_workflow_id?: ...;
                                            location_id: ...;
                                            location_name?: ...;
                                        }
                                        | {
                                            bearer_token: ...;
                                            extend_workflow_id?: ...;
                                            location_ids: ...;
                                            location_name?: ...;
                                        }
                                        | {
                                            api_id: ...;
                                            api_secret: ...;
                                            extend_workflow_id?: ...;
                                            location_name?: ...;
                                            realm_id: ...;
                                            service_facility_id: ...;
                                            sunwave_email: ...;
                                        }
                                        | {
                                            base_url: ...;
                                            client_id: ...;
                                            extend_workflow_id?: ...;
                                            rpa_vault_user_id: ...;
                                            rpa_workflow_id: ...;
                                            secret_key: ...;
                                        }
                                        | {
                                            as_of_date?: ...;
                                            extend_workflow_id?: ...;
                                            location_id: ...;
                                            location_name?: ...;
                                            seed: ...;
                                        }
                                        | {
                                            connector: ...;
                                            connector_label: ...;
                                            extend_workflow_id?: ...;
                                            org_id: ...;
                                            program_map?: ...;
                                            sync_from: ...;
                                        };
                                        id: string;
                                        label?: string;
                                        status?: "active"
                                        | "inactive";
                                    };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        created_by: string
                                        | null;
                                        credentials:
                                            | {
                                                app_id: ...;
                                                extend_workflow_id?: ...;
                                                location_id: ...;
                                                location_name?: ...;
                                            }
                                            | {
                                                bearer_token: ...;
                                                extend_workflow_id?: ...;
                                                location_ids: ...;
                                                location_name?: ...;
                                            }
                                            | {
                                                api_id: ...;
                                                api_secret: ...;
                                                extend_workflow_id?: ...;
                                                location_name?: ...;
                                                realm_id: ...;
                                                service_facility_id: ...;
                                                sunwave_email: ...;
                                            }
                                            | {
                                                base_url: ...;
                                                client_id: ...;
                                                extend_workflow_id?: ...;
                                                rpa_vault_user_id: ...;
                                                rpa_workflow_id: ...;
                                                secret_key: ...;
                                            }
                                            | {
                                                as_of_date?: ...;
                                                extend_workflow_id?: ...;
                                                location_id: ...;
                                                location_name?: ...;
                                                seed: ...;
                                            }
                                            | {
                                                connector: ...;
                                                connector_label: ...;
                                                extend_workflow_id?: ...;
                                                org_id: ...;
                                                program_map: ...;
                                                sync_from: ...;
                                            };
                                        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"
                                            | "synthetic"
                                            | "proxy_qualifacts_insync";
                                        updated_at: DbDate;
                                    };
                                },
                            >;
                            verifyEmrProxyConnection: MutationProcedure<
                                {
                                    input: {
                                        apiKey: string;
                                        integrationType: "proxy_qualifacts_insync";
                                        orgId: string;
                                    };
                                    meta: object;
                                    output: EmrProxyOrgSummary;
                                },
                            >;
                        },
                    >,
                >;
                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?:
                                            | "needs_review"
                                            | "name"
                                            | "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?:
                                            | "needs_review"
                                            | "question"
                                            | "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?:
                                            | "needs_review"
                                            | "name"
                                            | "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?:
                                            | "needs_review"
                                            | "name"
                                            | "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: "provider" | "assistant" | "client";
                                        facilityIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        scoreRange?: { max?: ...; min?: ... };
                                        search?: string;
                                        sortBy?:
                                            | "needs_review"
                                            | "name"
                                            | "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"
                                        | "org_supervisor";
                                        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"
                                        | "syntheticEmrEnabled"
                                        | "proxyExtendSubmissionEnabled"
                                        | "sessionAudioDownloadEnabled";
                                        value: unknown;
                                    };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        entity_id: number & { __brand: ... };
                                        id: EntitySettingId;
                                        setting_key:
                                            | "emrIntegrationEnabled"
                                            | "sessionNoteGenerationEnabled"
                                            | "chartReviewEnabled"
                                            | "formFillingEnabled"
                                            | "syntheticEmrEnabled"
                                            | "proxyExtendSubmissionEnabled"
                                            | "sessionAudioDownloadEnabled";
                                        updated_at: DbDate;
                                        updated_by: (...) & (...)
                                        | null;
                                        value: boolean;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                patientCharts: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            countForPatient: QueryProcedure<
                                {
                                    input: { patientId: string; pieces?: "exclude"
                                    | "include" };
                                    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?: ...;
                                            levelOfCareName?: ...;
                                            patientId: ...;
                                            patientName: ...;
                                            programEnd?: ...;
                                            programName?: ...;
                                            programStart?: ...;
                                            proxy?: ...;
                                            urLevelOfCareName?: ...;
                                        }
                                        | null;
                                        created_at: DbDate;
                                        created_by: (...) & (...)
                                        | null;
                                        embedding_count: string | null;
                                        embedding_err_msg: string | null;
                                        embedding_status:
                                            | "pending"
                                            | "processing"
                                            | "completed"
                                            | "failed"
                                            | "parse"
                                            | "extract"
                                            | null;
                                        entity_id: (...) & (...)
                                        | null;
                                        extend_content_hash: string | null;
                                        extend_run_id: (...) & (...) | null;
                                        extend_source: "insync-rpa" | "v2-patient-charts" | "proxy" | null;
                                        extended_at: (...) & (...) | 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"
                                            | "insync_rpa_locadtr"
                                            | "insync_rpa_treatment_plan"
                                            | "insync_rpa_biopsychosocial"
                                            | "synthetic_biopsychosocial"
                                            | "synthetic_asam"
                                            | "synthetic_consent"
                                            | "synthetic_nursing_intake"
                                            | "synthetic_diagnosis"
                                            | "synthetic_treatment_plan"
                                            | "synthetic_group_note"
                                            | "synthetic_progress_note"
                                            | "synthetic_ur_review"
                                            | "synthetic_discharge_summary"
                                            | "insync_rpa_encounter_note"
                                            | "insync_rpa_consent_form"
                                            | "insync_rpa_lab_result"
                                            | "insync_rpa_insurance"
                                            | "insync_rpa_document"
                                            | 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;
                                        packet_role: "standalone" | "packet" | "piece";
                                        packet_section_index: number | null;
                                        page_end: number | null;
                                        page_start: number | null;
                                        parent_patient_chart_id: (...) & (...) | null;
                                        patient_id: (...) & (...) | null;
                                        raw_document: unknown;
                                        run_id: string | null;
                                        sources: unknown;
                                        treatment_episode_id: (...) & (...) | null;
                                        updated_at: (...) & (...) | null;
                                    };
                                },
                            >;
                            documentTypesForPatient: QueryProcedure<
                                {
                                    input: { patientId: string; treatmentEpisodeId?: string };
                                    meta: object;
                                    output: (
                                        | "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"
                                        | "insync_rpa_locadtr"
                                        | "insync_rpa_treatment_plan"
                                        | "insync_rpa_biopsychosocial"
                                        | "synthetic_biopsychosocial"
                                        | "synthetic_asam"
                                        | "synthetic_consent"
                                        | "synthetic_nursing_intake"
                                        | "synthetic_diagnosis"
                                        | "synthetic_treatment_plan"
                                        | "synthetic_group_note"
                                        | "synthetic_progress_note"
                                        | "synthetic_ur_review"
                                        | "synthetic_discharge_summary"
                                        | "insync_rpa_encounter_note"
                                        | "insync_rpa_consent_form"
                                        | "insync_rpa_lab_result"
                                        | "insync_rpa_insurance"
                                        | "insync_rpa_document"
                                    )[];
                                },
                            >;
                            getById: QueryProcedure<
                                {
                                    input: { id: string; patientId: string };
                                    meta: object;
                                    output: {
                                        circle_metadata:
                                            | {
                                                admittedAt: ...;
                                                capturedAt: ...;
                                                dischargedAt: ...;
                                                entityId: ...;
                                                episodeEnd?: ...;
                                                episodeStart?: ...;
                                                levelOfCareName?: ...;
                                                patientId: ...;
                                                patientName: ...;
                                                programEnd?: ...;
                                                programName?: ...;
                                                programStart?: ...;
                                                proxy?: ...;
                                                urLevelOfCareName?: ...;
                                            }
                                            | null;
                                        created_at: DbDate;
                                        embedding_err_msg: string
                                        | null;
                                        embedding_status:
                                            | "pending"
                                            | "processing"
                                            | "completed"
                                            | "failed"
                                            | "parse"
                                            | "extract"
                                            | 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"
                                        | "insync_rpa_locadtr"
                                        | "insync_rpa_treatment_plan"
                                        | "insync_rpa_biopsychosocial"
                                        | "synthetic_biopsychosocial"
                                        | "synthetic_asam"
                                        | "synthetic_consent"
                                        | "synthetic_nursing_intake"
                                        | "synthetic_diagnosis"
                                        | "synthetic_treatment_plan"
                                        | "synthetic_group_note"
                                        | "synthetic_progress_note"
                                        | "synthetic_ur_review"
                                        | "synthetic_discharge_summary"
                                        | "insync_rpa_encounter_note"
                                        | "insync_rpa_consent_form"
                                        | "insync_rpa_lab_result"
                                        | "insync_rpa_insurance"
                                        | "insync_rpa_document"
                                        | null;
                                        facility_timezone: string
                                        | null;
                                        file_name: string | null;
                                        file_type:
                                            | "patient_chart"
                                            | "generated_form"
                                            | "emr_document"
                                            | null;
                                        file_url: string
                                        | null;
                                        id: PatientChartId;
                                        open_at_page: number | null;
                                        packet: { file_name: ...; id: ... } | null;
                                        packet_role: "standalone" | "packet" | "piece";
                                        page_end: number | null;
                                        page_start: number | null;
                                        patient_id: (...) & (...) | null;
                                        raw_document: unknown;
                                        signed_url: string | null;
                                    };
                                },
                            >;
                            getTraceLinks: QueryProcedure<
                                {
                                    input: { patientChartId: string };
                                    meta: object;
                                    output:
                                        | {
                                            cloudcruiseSessionId: (...)
                                            | (...);
                                            extendRunId: (...) | (...);
                                            extendWorkflowId: (...) | (...);
                                        }
                                        | null;
                                },
                            >;
                            listAllIdsForPatient: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        dateFrom?: string;
                                        dateTo?: string;
                                        externalDocumentType?: unknown;
                                        fileType?: unknown;
                                        patientId: string;
                                        pieces?: "exclude"
                                        | "include";
                                        search?: string;
                                        sortOrder?: "asc" | "desc";
                                        treatmentEpisodeId?: string;
                                    };
                                    meta: object;
                                    output: PatientChartId[];
                                },
                            >;
                            listByIds: QueryProcedure<
                                {
                                    input: { ids: string[]; patientId: string };
                                    meta: object;
                                    output: Pick<
                                        {
                                            circle_metadata: ...;
                                            created_at: ...;
                                            created_by: ...;
                                            embedding_count: ...;
                                            embedding_err_msg: ...;
                                            embedding_status: ...;
                                            entity_id: ...;
                                            extend_content_hash: ...;
                                            extend_run_id: ...;
                                            extend_source: ...;
                                            extended_at: ...;
                                            external_document_created_at: ...;
                                            external_document_id: ...;
                                            external_document_type: ...;
                                            external_document_updated_at: ...;
                                            file_name: ...;
                                            file_type: ...;
                                            file_url: ...;
                                            id: ...;
                                            integration_id: ...;
                                            is_ready: ...;
                                            packet_role: ...;
                                            packet_section_index: ...;
                                            page_end: ...;
                                            page_start: ...;
                                            parent_patient_chart_id: ...;
                                            patient_id: ...;
                                            raw_document: ...;
                                            run_id: ...;
                                            sources: ...;
                                            treatment_episode_id: ...;
                                            updated_at: ...;
                                        },
                                        (...)
                                        | (...)
                                        | (...),
                                    >[];
                                },
                            >;
                            listForPatient: QueryProcedure<
                                {
                                    input: {
                                        cursor?: number;
                                        dateFrom?: string;
                                        dateTo?: string;
                                        externalDocumentType?: unknown;
                                        fileType?: unknown;
                                        limit?: number;
                                        offset?: number;
                                        patientId: string;
                                        pieces?: "exclude"
                                        | "include";
                                        search?: string;
                                        sortOrder?: "asc" | "desc";
                                        treatmentEpisodeId?: string;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            created_at: DbDate;
                                            embedding_status: | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                            external_document_created_at: (...) | (...);
                                            external_document_type:
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...);
                                            file_name: (...) | (...);
                                            file_type: (...) | (...) | (...) | (...);
                                            file_url: (...) | (...);
                                            id: PatientChartId;
                                            packet_role: (...) | (...) | (...);
                                            page_end: (...) | (...);
                                            page_start: (...) | (...);
                                            parent_patient_chart_id: (...) | (...);
                                            patient_id: (...) | (...);
                                            piece_count: (...) | (...);
                                            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: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listPacketPieces: QueryProcedure<
                                {
                                    input: { packetId: string; patientId: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        embedding_status:
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                        external_document_created_at: (...) | (...);
                                        external_document_type:
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                        file_name: (...) | (...);
                                        file_type: (...) | (...) | (...) | (...);
                                        file_url: (...) | (...);
                                        id: PatientChartId;
                                        packet_role: (...) | (...) | (...);
                                        packet_section_index: (...) | (...);
                                        page_end: (...) | (...);
                                        page_start: (...) | (...);
                                        parent_patient_chart_id: (...) | (...);
                                        patient_id: (...) | (...);
                                        treatment_episode_id: (...) | (...);
                                        updated_at: (...) | (...);
                                    }[];
                                },
                            >;
                            preprocessForPatient: MutationProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: EnqueueChartPreprocessingResult;
                                },
                            >;
                            reprocess: MutationProcedure<
                                {
                                    input: { patientChartId: string; patientId: string };
                                    meta: object;
                                    output: { newRunIds: ExtendRunId[] };
                                },
                            >;
                        },
                    >,
                >;
                patientInsurances: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            listForPatient: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        effective_date: (...) | (...);
                                        group_id: (...) | (...);
                                        id: PatientInsuranceId;
                                        notes: (...) | (...);
                                        patient_id: (...) & (...);
                                        payor_id: (...) & (...);
                                        payor_name: (...) | (...);
                                        plan_type: (...) | (...);
                                        policy_number: (...) | (...);
                                        priority: (...) | (...);
                                        status: (...) | (...);
                                        subscriber_address_city: (...) | (...);
                                        subscriber_address_country: (...) | (...);
                                        subscriber_address_state: (...) | (...);
                                        subscriber_address_street: (...) | (...);
                                        subscriber_address_street2: (...) | (...);
                                        subscriber_address_zip: (...) | (...);
                                        subscriber_dob: (...) | (...);
                                        subscriber_first_name: (...) | (...);
                                        subscriber_gender: (...) | (...);
                                        subscriber_last_name: (...) | (...);
                                        subscriber_relationship: (...) | (...);
                                        termination_date: (...) | (...);
                                    }[];
                                },
                            >;
                        },
                    >,
                >;
                patients: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            clonePatientToEval: MutationProcedure<
                                {
                                    input: {
                                        auditTemplateIds?: (...)[];
                                        forceRun?: boolean;
                                        patientId: string;
                                    };
                                    meta: object;
                                    output: EnqueueClonePatientToEvalResult;
                                },
                            >;
                            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;
                                        archive_reason: "emr_deleted" | "manual" | null;
                                        archived: boolean;
                                        archived_at: (...) & (...) | 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"
                                            | "synthetic"
                                            | "proxy_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 } },
                            >;
                            getCloneToEvalStatus: QueryProcedure<
                                {
                                    input: { messageId: string };
                                    meta: object;
                                    output: { status: CloneToEvalStatus };
                                },
                            >;
                            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;
                                        archive_reason: "emr_deleted" | "manual" | null;
                                        archived: boolean;
                                        archived_at: (...) & (...) | 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"
                                            | "synthetic"
                                            | "proxy_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;
                                        archived: boolean;
                                        archived_at: (...) & (...) | null;
                                        created_at: DbDate;
                                        discharged_at: string | null;
                                        dob: string | null;
                                        external_source:
                                            | "kipu"
                                            | "lightningstep"
                                            | "sunwave"
                                            | "qualifacts_insync"
                                            | "synthetic"
                                            | "proxy_qualifacts_insync"
                                            | null;
                                        facility_id: (...) & (...)
                                        | null;
                                        facility_name: string | null;
                                        first_name: string | null;
                                        last_name: string | null;
                                        last_sync: string | null;
                                        last_synced_documents: string | null;
                                        latest_episode_mrn: 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_start_source: (...) | (...) | (...);
                                        discharge_date: (...) | (...);
                                        episode_start: (...) | (...);
                                        external_id: (...) | (...);
                                        facility_level_of_care_id: (...) | (...);
                                        facility_name: (...) | (...);
                                        facility_timezone: (...) | (...);
                                        id: TreatmentEpisodeId;
                                        integration_id: (...) | (...);
                                        integration_status: (...) | (...) | (...) | (...);
                                        integration_type:
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...)
                                            | (...);
                                        last_synced_documents: (...) | (...);
                                        level_of_care_name: (...) | (...);
                                        mrn: (...) | (...);
                                        status: (...) | (...);
                                    }[];
                                },
                            >;
                            listInOrganization: QueryProcedure<
                                {
                                    input: {
                                        admissionStatus?: "active"
                                        | "all"
                                        | "discharged";
                                        cursor?: number;
                                        facilityId?: unknown;
                                        facilityIdsForLoc?: (...)[];
                                        facilityIdsForProgram?: (...)[];
                                        includeArchived?: boolean;
                                        levelOfCareIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        patientIds?: unknown;
                                        patientSearch?: string;
                                        primaryProviderId?: unknown;
                                        programIds?: (...)[];
                                        sortBy?: "name" | "created_at" | "admitted_at" | "discharged_at";
                                        sortOrder?: "asc" | "desc";
                                        status?: unknown;
                                    };
                                    meta: object;
                                    output: PaginatedResponse<
                                        {
                                            admitted_at: (...)
                                            | (...);
                                            archived: boolean;
                                            archived_at: (...) | (...);
                                            created_at: DbDate;
                                            discharged_at: (...) | (...);
                                            dob: (...) | (...);
                                            entity_id: (...) | (...);
                                            external_source:
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...)
                                                | (...);
                                            facility_id: (...) | (...);
                                            facility_name: (...) | (...);
                                            first_name: (...) | (...);
                                            last_name: (...) | (...);
                                            last_updated_summary: (...) | (...);
                                            latest_episode_id: (...) | (...);
                                            latest_episode_mrn: (...) | (...);
                                            latest_episode_start: (...) | (...);
                                            level_of_care_name: (...) | (...);
                                            patient_id: PatientId;
                                            primary_provider_id: (...) | (...);
                                            program_name: (...) | (...);
                                            provider_first_name: (...) | (...);
                                            provider_last_name: (...) | (...);
                                            provider_title: (...) | (...);
                                            status: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listProgramStays: QueryProcedure<
                                {
                                    input: { episodeId: string; patientId: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        end_date: (...) | (...);
                                        external_id: (...) | (...);
                                        facility_level_of_care_id: (...) | (...);
                                        facility_program_id: (...) | (...);
                                        id: ProgramStayId;
                                        integration_id: (...) | (...);
                                        legacy_admission_id: (...) | (...);
                                        program_name: (...) | (...);
                                        start_date: string;
                                        treatment_episode_id: string;
                                        updated_at: DbDate;
                                    }[];
                                },
                            >;
                            mergePatients: MutationProcedure<
                                {
                                    input: { duplicatePatientId: string; primaryPatientId: string };
                                    meta: object;
                                    output: ExecutePatientMergeServiceResult;
                                },
                            >;
                            setPatientArchived: MutationProcedure<
                                {
                                    input: { archived: boolean; patientId: string };
                                    meta: object;
                                    output: { archived: boolean; patientId: PatientId };
                                },
                            >;
                            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;
                                        archive_reason: "emr_deleted" | "manual" | null;
                                        archived: boolean;
                                        archived_at: (...) & (...) | 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"
                                            | "synthetic"
                                            | "proxy_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:
                                            | "in_progress"
                                            | "pass"
                                            | "fail"
                                            | "needs_review"
                                            | "pending"
                                            | "not_started"
                                            | "error"
                                            | 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:
                                            | "processing"
                                            | "failed"
                                            | "initialized"
                                            | "transcribing"
                                            | "complete"
                                            | 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: ...;
                                            [x: ...]: ...;
                                        }
                                        | null;
                                        start_timestamp: DbDate;
                                        transcript: string
                                        | null;
                                        updated_by: number | null;
                                    };
                                },
                            >;
                            generateNote: MutationProcedure<
                                {
                                    input: {
                                        endedAt?: string;
                                        fileUrl?: string;
                                        manualText?: string;
                                        patientId: string;
                                        startedAt?: 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<(...)[]> };
                                },
                            >;
                            listEvidenceOptions: QueryProcedure<
                                {
                                    input: { limit?: number; patientId: string };
                                    meta: object;
                                    output: {
                                        items: { id: ...; startedAt: ...; templateTitle: ... }[];
                                        total: number;
                                    };
                                },
                            >;
                            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:
                                            | "in_progress"
                                            | "pass"
                                            | "fail"
                                            | "needs_review"
                                            | "pending"
                                            | "not_started"
                                            | "error"
                                            | 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:
                                            | "processing"
                                            | "failed"
                                            | "initialized"
                                            | "transcribing"
                                            | "complete"
                                            | 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: ...;
                                            [x: ...]: ...;
                                        }
                                        | 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:
                                            | "in_progress"
                                            | "pass"
                                            | "fail"
                                            | "needs_review"
                                            | "pending"
                                            | "not_started"
                                            | "error"
                                            | 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:
                                            | "processing"
                                            | "failed"
                                            | "initialized"
                                            | "transcribing"
                                            | "complete"
                                            | 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: ...;
                                            [x: ...]: ...;
                                        }
                                        | null;
                                        start_timestamp: DbDate;
                                        transcript: string
                                        | null;
                                        updated_by: number | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                patientUtilizationReviews: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            listForPatient: QueryProcedure<
                                {
                                    input: { patientId: string; treatmentEpisodeId?: string };
                                    meta: object;
                                    output: {
                                        authorization_date: (...) | (...);
                                        authorization_number: (...) | (...);
                                        created_at: DbDate;
                                        end_date: (...) | (...);
                                        entity_id: (...) & (...);
                                        external_utilization_review_id: string;
                                        facility_level_of_care_id: (...) | (...);
                                        frequency: (...) | (...);
                                        id: PatientUtilizationReviewId;
                                        insurance: (...) | (...);
                                        integration_id: (...) & (...);
                                        lcd: boolean;
                                        level_of_care_id: (...) | (...);
                                        level_of_care_name: (...) | (...);
                                        next_care_level: (...) | (...);
                                        next_care_level_date: (...) | (...);
                                        next_review: (...) | (...);
                                        number_of_days: (...) | (...);
                                        patient_admission_id: (...) & (...);
                                        patient_id: (...) & (...);
                                        payor_id: (...) | (...);
                                        payor_name: (...) | (...);
                                        start_date: (...) | (...);
                                        status: (...) | (...);
                                        treatment_episode_id: (...) | (...);
                                        updated_at: DbDate;
                                    }[];
                                },
                            >;
                        },
                    >,
                >;
                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"
                                            | "synthetic"
                                            | "proxy_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:
                                            | "active"
                                            | "inactive"
                                            | "trial_ended"
                                            | "trial_running"
                                            | null;
                                        title: string
                                        | null;
                                        user_id: (...) & (...) | null;
                                        vertical: string | null;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                programStays: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            listForPatient: QueryProcedure<
                                {
                                    input: { patientId: string; treatmentEpisodeId?: string };
                                    meta: object;
                                    output: {
                                        created_at: DbDate;
                                        end_date: (...) | (...);
                                        external_id: (...) | (...);
                                        facility_level_of_care_id: (...) | (...);
                                        facility_program_id: (...) | (...);
                                        id: ProgramStayId;
                                        integration_id: (...) | (...);
                                        legacy_admission_id: (...) | (...);
                                        level_of_care_name: (...) | (...);
                                        program_name: (...) | (...);
                                        start_date: string;
                                        treatment_episode_id: string;
                                        updated_at: DbDate;
                                    }[];
                                },
                            >;
                        },
                    >,
                >;
                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?: "active" | "all" | "discharged";
                                        auditTemplateIds?: (...)[];
                                        authEndDateRange?: { from: ...; to: ... };
                                        authStartDateRange?: { from: ...; to: ... };
                                        clientSearch?: string;
                                        clinicalLevelOfCareIds?: (...)[];
                                        criteriaStatuses?: (...)[];
                                        cursor?: number;
                                        dateRange?: { from: ...; to: ... };
                                        facilityIds?: (...)[];
                                        facilityIdsForClinicalLoc?: (...)[];
                                        facilityIdsForLoc?: (...)[];
                                        facilityIdsForProgram?: (...)[];
                                        facilityIdsForUrLoc?: (...)[];
                                        hasUnansweredManual?: boolean;
                                        includeNullTriggers?: boolean;
                                        levelOfCareIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        profileIds?: (...)[];
                                        programIds?: (...)[];
                                        scoreRange?: { max?: ...; min?: ... };
                                        sortBy?:
                                            | "episode_start_date"
                                            | "level_of_care"
                                            | "type"
                                            | "trigger"
                                            | "mrn"
                                            | "created_at"
                                            | "admission_date"
                                            | "facility"
                                            | "ur_level_of_care"
                                            | "auth_end_date"
                                            | "score"
                                            | "provider_name"
                                            | "patient_name"
                                            | "assistant_name"
                                            | "auth_start_date"
                                            | "episode_end_date"
                                            | "program_stay_start"
                                            | "program_stay_end"
                                            | "current_program"
                                            | "clinical_level_of_care";
                                        sortOrder?: "asc"
                                        | "desc";
                                        triggerIds?: (...)[];
                                        type?: "chart_review" | "session_notes";
                                        urLevelOfCareIds?: (...)[];
                                    };
                                    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;
                                            clinical_level_of_care: (...) | (...);
                                            criteria: (...)[];
                                            current_program: (...) | (...);
                                            episode_end_date: (...) | (...);
                                            episode_start_date: (...) | (...);
                                            facility_name: string;
                                            is_discharged: boolean;
                                            level_of_care: (...) | (...);
                                            manual_pending_count: number;
                                            mrn: (...) | (...);
                                            pass_count: number;
                                            program_stay_end: (...) | (...);
                                            program_stay_start: (...) | (...);
                                            provider_name: string;
                                            run_created_at: (...) | (...);
                                            run_id: (...) | (...);
                                            score_pct: number;
                                            total_count: number;
                                            total_rows: string;
                                            trigger: (...) | (...);
                                            type: (...) | (...);
                                            ur_level_of_care: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                            listGrouped: QueryProcedure<
                                {
                                    input: {
                                        admissionDateRange?: { from: ...; to: ... };
                                        admissionStatus?: "active" | "all" | "discharged";
                                        auditTemplateIds?: (...)[];
                                        authEndDateRange?: { from: ...; to: ... };
                                        authStartDateRange?: { from: ...; to: ... };
                                        clientSearch?: string;
                                        clinicalLevelOfCareIds?: (...)[];
                                        criteriaStatuses?: (...)[];
                                        cursor?: number;
                                        dateRange?: { from: ...; to: ... };
                                        facilityIds?: (...)[];
                                        facilityIdsForClinicalLoc?: (...)[];
                                        facilityIdsForLoc?: (...)[];
                                        facilityIdsForProgram?: (...)[];
                                        facilityIdsForUrLoc?: (...)[];
                                        hasUnansweredManual?: boolean;
                                        includeNullTriggers?: boolean;
                                        levelOfCareIds?: (...)[];
                                        limit?: number;
                                        offset?: number;
                                        profileIds?: (...)[];
                                        programIds?: (...)[];
                                        scoreRange?: { max?: ...; min?: ... };
                                        sortBy?:
                                            | "episode_start_date"
                                            | "level_of_care"
                                            | "type"
                                            | "trigger"
                                            | "mrn"
                                            | "created_at"
                                            | "admission_date"
                                            | "facility"
                                            | "ur_level_of_care"
                                            | "auth_end_date"
                                            | "score"
                                            | "provider_name"
                                            | "patient_name"
                                            | "assistant_name"
                                            | "auth_start_date"
                                            | "episode_end_date"
                                            | "program_stay_start"
                                            | "program_stay_end"
                                            | "current_program"
                                            | "clinical_level_of_care";
                                        sortOrder?: "asc"
                                        | "desc";
                                        triggerIds?: (...)[];
                                        type?: "chart_review" | "session_notes";
                                        urLevelOfCareIds?: (...)[];
                                    };
                                    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;
                                            clinical_level_of_care: (...) | (...);
                                            criteria: (...)[];
                                            current_program: (...) | (...);
                                            episode_end_date: (...) | (...);
                                            episode_start_date: (...) | (...);
                                            facility_name: string;
                                            is_discharged: boolean;
                                            level_of_care: (...) | (...);
                                            manual_pending_count: number;
                                            mrn: (...) | (...);
                                            pass_count: number;
                                            program_stay_end: (...) | (...);
                                            program_stay_start: (...) | (...);
                                            provider_name: string;
                                            run_created_at: (...) | (...);
                                            run_id: (...) | (...);
                                            score_pct: number;
                                            total_count: number;
                                            total_rows: string;
                                            trigger: (...) | (...);
                                            type: (...) | (...);
                                            ur_level_of_care: (...) | (...);
                                        },
                                    >;
                                },
                            >;
                        },
                    >,
                >;
                rulebook: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            create: MutationProcedure<
                                {
                                    input: {
                                        conceptId: string;
                                        gradeOpenPeriods?: boolean;
                                        quantifier?: "every"
                                        | "all";
                                        spec:
                                            | { evidence: ...; expectation: ...; kind: ...; version: ... }
                                            | { evidence: ...; kind: ...; signatures: ...; version: ... };
                                        trigger:
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { conceptId: ...; offsetSeconds: ...; on: ... };
                                        window:
                                            | { after: ...; kind: ...; withinHours: ... }
                                            | { kind: ... }
                                            | { every: ...; kind: ...; since?: ... };
                                    };
                                    meta: object;
                                    output: CreateRuleOutput;
                                },
                            >;
                            evaluateRuleNow: MutationProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: ListFindingsOutput;
                                },
                            >;
                            get: QueryProcedure<
                                { input: { id: string }; meta: object; output: RuleSummaryDto },
                            >;
                            list: QueryProcedure<
                                {
                                    input: { enabled?: boolean };
                                    meta: object;
                                    output: ListRulesOutput;
                                },
                            >;
                            listFindings: QueryProcedure<
                                {
                                    input: { patientId: string };
                                    meta: object;
                                    output: ListFindingsOutput;
                                },
                            >;
                            revise: MutationProcedure<
                                {
                                    input: {
                                        conceptId: string;
                                        gradeOpenPeriods?: boolean;
                                        quantifier?: "every"
                                        | "all";
                                        ruleId: string;
                                        spec:
                                            | { evidence: ...; expectation: ...; kind: ...; version: ... }
                                            | { evidence: ...; kind: ...; signatures: ...; version: ... };
                                        trigger:
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { offsetSeconds: ...; on: ... }
                                            | { conceptId: ...; offsetSeconds: ...; on: ... };
                                        window:
                                            | { after: ...; kind: ...; withinHours: ... }
                                            | { kind: ... }
                                            | { every: ...; kind: ...; since?: ... };
                                    };
                                    meta: object;
                                    output: ReviseRuleOutput;
                                },
                            >;
                            setEnabled: MutationProcedure<
                                {
                                    input: { enabled: boolean; ruleId: string };
                                    meta: object;
                                    output: SetRuleEnabledOutput;
                                },
                            >;
                            softDelete: MutationProcedure<
                                {
                                    input: { reason: string; ruleId: string };
                                    meta: object;
                                    output: SoftDeleteRuleOutput;
                                },
                            >;
                        },
                    >,
                >;
                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;
                                        sortBy?: string
                                        | null;
                                        sortOrder?: "asc" | "desc" | null;
                                        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: {
                                        assignees?: (...)[];
                                        assistantIds?: (...)[];
                                        facilityIds?: (...)[];
                                        patientIds?: (...)[];
                                        providerIds?: (...)[];
                                        triggerIds?: (...)[];
                                    };
                                    meta: object;
                                    output: {
                                        assigneeItems: ((...) | (...))[];
                                        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;
                                        sortBy: string
                                        | null;
                                        sortOrder: "asc" | "desc" | null;
                                        viewMode: "flat" | "grouped";
                                    };
                                    meta: object;
                                    output: SavedViewDto;
                                },
                            >;
                        },
                    >,
                >;
                storage: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            createSessionUploadTarget: MutationProcedure<
                                {
                                    input: { contentType: string; patientId: string };
                                    meta: object;
                                    output: { bucket: string; config: StorageCredentials; key: string };
                                },
                            >;
                            uploadCredentials: QueryProcedure<
                                { input: void; meta: object; output: StorageCredentials },
                            >;
                        },
                    >,
                >;
                superadmin: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            aiFeedback: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        addComment: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        createLinearIssue: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        deleteComment: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        list: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        listComments: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        setSeverity: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        setStatus: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        updateComment: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                            auditRuns: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        compareQuestion: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        getQuestionById: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        list: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        requeue: MutationProcedure<{ input: ...; meta: ...; output: ... }>;
                                        rerunQuestionV3: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        resolveCompareDefaults: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                            automationRuns: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        filterOptions: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        get: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        getRecording: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        list: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        listGroupedByPatient: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        retry: MutationProcedure<{ input: ...; meta: ...; output: ... }>;
                                    },
                                >,
                            >;
                            evalClones: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        delete: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        list: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                    },
                                >,
                            >;
                            evals: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        createDatasetExamples: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        runDateResolutionExperiment: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        runExpandQuestionExperiment: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        runExperiment: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                            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: ... },
                                        >;
                                        startUserImpersonation: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                            orgs: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        create: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        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: ... }>;
                                        listClients: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        listRoles: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        transferClients: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        updateRole: MutationProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                    },
                                >,
                            >;
                            templates: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        list: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        listCreators: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        listForExport: QueryProcedure<
                                            { input: ...; meta: ...; output: ... },
                                        >;
                                        restore: MutationProcedure<{ input: ...; meta: ...; output: ... }>;
                                    },
                                >,
                            >;
                            usage: BuiltRouter<
                                {
                                    ctx: TRPCContext;
                                    errorShape: DefaultErrorShape;
                                    meta: object;
                                    transformer: false;
                                },
                                DecorateCreateRouterOptions<
                                    {
                                        get: QueryProcedure<{ input: ...; meta: ...; output: ... }>;
                                        listFacilities: QueryProcedure<
                                            { 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;
                                        deleted: boolean;
                                        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;
                                        deleted: boolean;
                                        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;
                                        deleted: boolean;
                                        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: (...) | (...) | (...);
                                            deleted: boolean;
                                            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;
                                        deletedOnly?: boolean;
                                        includeDeleted?: boolean;
                                        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;
                                        },
                                    >;
                                },
                            >;
                            restore: 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;
                                        deleted: boolean;
                                        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;
                                    };
                                },
                            >;
                            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;
                                        deleted: boolean;
                                        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;
                                        deleted: boolean;
                                        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;
                                    };
                                },
                            >;
                        },
                    >,
                >;
                utilization: BuiltRouter<
                    {
                        ctx: TRPCContext;
                        errorShape: DefaultErrorShape;
                        meta: object;
                        transformer: false;
                    },
                    DecorateCreateRouterOptions<
                        {
                            episodeAuthorizations: QueryProcedure<
                                {
                                    input: { patientId: string; treatmentEpisodeId: string };
                                    meta: object;
                                    output: {
                                        authorizations: {
                                            days: ...;
                                            endDate: ...;
                                            id: ...;
                                            levelOfCare: ...;
                                            nextReview: ...;
                                            payer: ...;
                                            startDate: ...;
                                            status: ...;
                                        }[];
                                        canSeePayer: boolean;
                                    };
                                },
                            >;
                            facilityLedger: QueryProcedure<
                                {
                                    input: { facilityId: string; facilityProgramId?: (...)
                                    | (...) } & { from: string; to: string };
                                    meta: object;
                                    output: {
                                        canSeePayer: boolean;
                                        facility: { id: FacilityId; name: string; timezone: (...) | (...) };
                                        freshness: {
                                            asOf: DbDate;
                                            currentThrough: (...) | (...);
                                            lastSyncedAt: (...) | (...);
                                        };
                                        programs: { id: ...; name: ... }[];
                                        rows: {
                                            absences: ...;
                                            admittedAt: ...;
                                            attendedDays: ...;
                                            attendedHours: ...;
                                            authDays: ...;
                                            authEnd: ...;
                                            authStart: ...;
                                            authUsed: ...;
                                            displayName: ...;
                                            documentedServices: ...;
                                            levelOfCare: ...;
                                            overlaps: ...;
                                            patientId: ...;
                                            payer: ...;
                                            program: ...;
                                            treatmentEpisodeId: ...;
                                        }[];
                                        serviceTypes: {
                                            attendedDays: ...;
                                            attendedHours: ...;
                                            averageAttendedMinutes: ...;
                                            clinicians: ...;
                                            instances: ...;
                                            instancesWithWindow: ...;
                                            name: ...;
                                            patients: ...;
                                            serviceType: ...;
                                        }[];
                                    };
                                },
                            >;
                            listFacilities: QueryProcedure<
                                {
                                    input: { from: string; to: string };
                                    meta: object;
                                    output: {
                                        activePatients: number;
                                        facilities: {
                                            absences: ...;
                                            activePatients: ...;
                                            attendedDays: ...;
                                            attendedHours: ...;
                                            documentedServices: ...;
                                            facilityId: ...;
                                            lastSyncedAt: ...;
                                            name: ...;
                                            overlaps: ...;
                                            timezone: ...;
                                        }[];
                                        freshness: {
                                            asOf: string;
                                            currentThrough: (...)
                                            | (...);
                                            lastSyncedAt: (...) | (...);
                                        };
                                    };
                                },
                            >;
                            listForPatient: QueryProcedure<
                                {
                                    input: { patientId: string; treatmentEpisodeId?: string };
                                    meta: object;
                                    output: { events: UtilizationEvent[]; timezone: string | null };
                                },
                            >;
                        },
                    >,
                >;
            },
        >,
    > = ...