import { z } from "zod";
import type { CalendarEvent, CalEventResponses } from "@calcom/types/Calendar";
import type { CredentialPayload } from "@calcom/types/Credential";
import type { CRM, Contact, CrmEvent } from "@calcom/types/CrmService";
import type { writeToRecordDataSchema } from "../zod";
import { SalesforceRecordEnum, RoutingReasons } from "./enums";
type Attendee = {
    email: string;
    name: string;
};
export default class SalesforceCRMService implements CRM {
    private integrationName;
    private conn;
    private log;
    private calWarnings;
    private appOptions;
    private doNotCreateEvent;
    private fallbackToContact;
    constructor(credential: CredentialPayload, appOptions: any, testMode?: boolean);
    getAppOptions(): any;
    private getClient;
    private getSalesforceUserIdFromEmail;
    private getSalesforceUserFromUserId;
    private getSalesforceEventBody;
    private salesforceCreateEventApiCall;
    private salesforceCreateEvent;
    private salesforceUpdateEvent;
    private salesforceDeleteEvent;
    handleEventCreation(event: CalendarEvent, contacts: Contact[]): Promise<{
        uid: string;
        id: string;
        type: string;
        password: string;
        url: string;
        additionalInfo: {
            contacts: Contact[];
            sfEvent: {
                success: true;
                id: string;
                errors: never[];
            };
            calWarnings: string[];
        };
    }>;
    createEvent(event: CalendarEvent, contacts: Contact[]): Promise<CrmEvent | undefined>;
    updateEvent(uid: string, event: CalendarEvent): Promise<CrmEvent>;
    deleteEvent(uid: string): Promise<void>;
    getContacts({ emails, includeOwner, forRoundRobinSkip, }: {
        emails: string | string[];
        includeOwner?: boolean;
        forRoundRobinSkip?: boolean;
    }): Promise<{
        ownerId?: string | undefined;
        ownerEmail?: any;
        id: any;
        email: string;
        recordType: any;
    }[]>;
    createContacts(contactsToCreate: Attendee[], organizerEmail?: string, calEventResponses?: CalEventResponses | null): Promise<{
        id: string;
        email: string;
    }[]>;
    handleAttendeeNoShow(bookingUid: string, attendees: {
        email: string;
        noShow: boolean;
    }[]): Promise<void>;
    private getExistingIdFromDuplicateError;
    private setDoNotCreateEvent;
    private getDoNotCreateEvent;
    private getDominantAccountId;
    private createAttendeeRecord;
    private generateCreateRecordBody;
    private ensureFieldsExistOnObject;
    private checkRecordOwnerNameFromRecordId;
    getAllPossibleAccountWebsiteFromEmailDomain(emailDomain: string): string;
    private getAccountIdBasedOnEmailDomainOfContacts;
    private getAccountBasedOnEmailDomainOfContacts;
    private setFallbackToContact;
    private getFallbackToContact;
    private writeToPersonRecord;
    private buildRecordUpdatePayload;
    private generateWriteToEventBody;
    private getTextFieldValue;
    private getTextValueFromRoutingFormResponse;
    private getTextValueFromBookingResponse;
    private getDateFieldValue;
    private fetchPersonRecord;
    private createNewContactUnderAnAccount;
    findUserEmailFromLookupField(attendeeEmail: string, fieldName: string, salesforceObject: SalesforceRecordEnum): Promise<{
        email: string;
        recordType: RoutingReasons;
    } | undefined>;
    /** Search the booking questions for the Company field value rather than relying on the email domain  */
    private getCompanyNameFromBookingResponse;
    private shouldSkipAttendeeIfFreeEmailDomain;
    incompleteBookingWriteToRecord(email: string, writeToRecordObject: z.infer<typeof writeToRecordDataSchema>): Promise<void>;
    /** All salesforce ids have a 3 character prefix associated with the record type
     * https://help.salesforce.com/s/articleView?id=000385203&type=1
     */
    private determineRecordTypeById;
    /** Prioritizes contacts over leads */
    private findProspectByEmail;
    private findContactByEmail;
    private findLeadByEmail;
}
export {};
//# sourceMappingURL=CrmService.d.ts.map