import type { ServiceAccountKey } from '../server/repository/delegationCredential';
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
export { buildNonDelegationCredentials, buildNonDelegationCredential } from "./clientAndServer";
interface DelegationCredential {
    id: string;
    workspacePlatform: {
        slug: string;
    };
    serviceAccountKey: ServiceAccountKey | null;
}
interface DelegationCredentialWithSensitiveServiceAccountKey extends DelegationCredential {
    serviceAccountKey: ServiceAccountKey;
}
interface User {
    email: string;
    id: number;
}
/**
 * Gets calendar as well as conferencing credentials(stored in-memory) for the user from the corresponding enabled DelegationCredential.
 */
export declare function getAllDelegationCredentialsForUser({ user }: {
    user: {
        email: string;
        id: number;
    };
}): Promise<{
    id: number;
    delegatedToId: string;
    userId: number;
    user: {
        email: string;
    };
    key: {
        access_token: string;
    };
    invalid: boolean;
    teamId: null;
    team: null;
    delegatedTo: {
        serviceAccountKey: import("zod").objectOutputType<{
            private_key: import("zod").ZodString;
            client_email: import("zod").ZodOptional<import("zod").ZodString>;
            client_id: import("zod").ZodString;
            tenant_id: import("zod").ZodOptional<import("zod").ZodString>;
        }, import("zod").ZodTypeAny, "passthrough">;
    } | null;
    type: `${string}_other` | `${string}_calendar` | `${string}_messaging` | `${string}_payment` | `${string}_video` | `${string}_automation` | `${string}_analytics` | `${string}_crm` | `${string}_other_calendar`;
    appId: string;
}[]>;
export declare function getAllDelegatedCalendarCredentialsForUser({ user, }: {
    user: {
        email: string;
        id: number;
    };
}): Promise<{
    id: number;
    delegatedToId: string;
    userId: number;
    user: {
        email: string;
    };
    key: {
        access_token: string;
    };
    invalid: boolean;
    teamId: null;
    team: null;
    delegatedTo: {
        serviceAccountKey: import("zod").objectOutputType<{
            private_key: import("zod").ZodString;
            client_email: import("zod").ZodOptional<import("zod").ZodString>;
            client_id: import("zod").ZodString;
            tenant_id: import("zod").ZodOptional<import("zod").ZodString>;
        }, import("zod").ZodTypeAny, "passthrough">;
    } | null;
    type: `${string}_other` | `${string}_calendar` | `${string}_messaging` | `${string}_payment` | `${string}_video` | `${string}_automation` | `${string}_analytics` | `${string}_crm` | `${string}_other_calendar`;
    appId: string;
}[]>;
export declare function checkIfSuccessfullyConfiguredInWorkspace({ delegationCredential, user, }: {
    delegationCredential: DelegationCredentialWithSensitiveServiceAccountKey;
    user: User;
}): Promise<boolean | undefined>;
export declare function getAllDelegationCredentialsForUserByAppType({ user, appType, }: {
    user: User;
    appType: string;
}): Promise<{
    id: number;
    delegatedToId: string;
    userId: number;
    user: {
        email: string;
    };
    key: {
        access_token: string;
    };
    invalid: boolean;
    teamId: null;
    team: null;
    delegatedTo: {
        serviceAccountKey: import("zod").objectOutputType<{
            private_key: import("zod").ZodString;
            client_email: import("zod").ZodOptional<import("zod").ZodString>;
            client_id: import("zod").ZodString;
            tenant_id: import("zod").ZodOptional<import("zod").ZodString>;
        }, import("zod").ZodTypeAny, "passthrough">;
    } | null;
    type: `${string}_other` | `${string}_calendar` | `${string}_messaging` | `${string}_payment` | `${string}_video` | `${string}_automation` | `${string}_analytics` | `${string}_crm` | `${string}_other_calendar`;
    appId: string;
}[]>;
export declare function getAllDelegationCredentialsForUserByAppSlug({ user, appSlug, }: {
    user: User;
    appSlug: string;
}): Promise<{
    id: number;
    delegatedToId: string;
    userId: number;
    user: {
        email: string;
    };
    key: {
        access_token: string;
    };
    invalid: boolean;
    teamId: null;
    team: null;
    delegatedTo: {
        serviceAccountKey: import("zod").objectOutputType<{
            private_key: import("zod").ZodString;
            client_email: import("zod").ZodOptional<import("zod").ZodString>;
            client_id: import("zod").ZodString;
            tenant_id: import("zod").ZodOptional<import("zod").ZodString>;
        }, import("zod").ZodTypeAny, "passthrough">;
    } | null;
    type: `${string}_other` | `${string}_calendar` | `${string}_messaging` | `${string}_payment` | `${string}_video` | `${string}_automation` | `${string}_analytics` | `${string}_crm` | `${string}_other_calendar`;
    appId: string;
}[]>;
type Host<TUser extends {
    id: number;
    email: string;
    credentials: CredentialPayload[];
}> = {
    user: TUser;
};
/**
 * Prepares credentials for use by CalendarService and EventManager
 * - Ensures no duplicate delegationCredentials caused by enrichment at possibly multiple places
 */
export declare const buildAllCredentials: ({ delegationCredentials, existingCredentials, }: {
    delegationCredentials: CredentialForCalendarService[];
    existingCredentials: CredentialPayload[];
}) => CredentialForCalendarService[];
export declare function enrichUsersWithDelegationCredentials<TUser extends {
    id: number;
    email: string;
    credentials: CredentialPayload[];
}>({ orgId, users }: {
    orgId: number | null;
    users: TUser[];
}): Promise<(Omit<TUser, "credentials"> & {
    credentials: CredentialForCalendarService[];
})[]>;
export declare const enrichHostsWithDelegationCredentials: <THost extends Host<TUser>, TUser extends {
    id: number;
    email: string;
    credentials: CredentialPayload[];
}>({ orgId, hosts, }: {
    orgId: number | null;
    hosts: THost[];
}) => Promise<(THost & {
    user: Omit<TUser, "credentials"> & {
        credentials: CredentialForCalendarService[];
    };
})[]>;
export declare const enrichUserWithDelegationCredentialsWithoutOrgId: <TUser extends {
    id: number;
    email: string;
    credentials: CredentialPayload[];
}>({ user, }: {
    user: TUser;
}) => Promise<Omit<TUser, "credentials"> & {
    credentials: CredentialForCalendarService[];
}>;
export declare function enrichUserWithDelegationConferencingCredentialsWithoutOrgId<TUser extends {
    id: number;
    email: string;
    credentials: CredentialPayload[];
}>({ user }: {
    user: TUser;
}): Promise<Omit<Omit<TUser, "credentials"> & {
    credentials: CredentialForCalendarService[];
}, "credentials"> & {
    credentials: CredentialForCalendarService[];
}>;
/**
 * Either get Delegation credential from delegationCredentials or find regular credential from Credential table
 */
export declare function getDelegationCredentialOrFindRegularCredential({ id, delegationCredentials, }: {
    id: {
        credentialId: number | null | undefined;
        delegationCredentialId: string | null | undefined;
    };
    delegationCredentials: CredentialForCalendarService[];
}): Promise<CredentialForCalendarService | null | undefined>;
/**
 * Utility function to find a credential from a list of credentials, supporting both regular and DelegationCredential credentials
 */
export declare function getDelegationCredentialOrRegularCredential<TCredential extends {
    delegatedToId?: string | null;
    id: number;
}>({ credentials, id, }: {
    credentials: TCredential[];
    id: {
        credentialId: number | null | undefined;
        delegationCredentialId: string | null | undefined;
    };
}): TCredential | null;
export declare function getFirstDelegationConferencingCredential({ credentials, }: {
    credentials: CredentialForCalendarService[];
}): CredentialForCalendarService | undefined;
export declare function getFirstDelegationConferencingCredentialAppLocation({ credentials, }: {
    credentials: CredentialForCalendarService[];
}): string | null;
//# sourceMappingURL=server.d.ts.map