import type { BookingRepository } from '../repositories/BookingRepository';
import type { HostRepository } from '../../host/repositories/HostRepository';
import type { PrismaOOORepository } from '../../ooo/repositories/PrismaOOORepository';
import type { UserRepository } from '../../users/repositories/UserRepository';
import type { PrismaAttributeRepository } from '../../../lib/server/repository/PrismaAttributeRepository';
import type { Prisma } from '../../../kysely/types.ts';
import type { User, Booking, SelectedCalendar } from '../../../kysely/types.ts';
import { RRTimestampBasis, RRResetInterval } from '../../../prisma/enums';
import type { CredentialForCalendarService } from "@calcom/types/Credential";
type PartialBooking = Pick<Booking, "id" | "createdAt" | "userId" | "status"> & {
    attendees: {
        email: string | null;
    }[];
};
type PartialUser = Pick<User, "id" | "email">;
export type RoutingFormResponse = {
    response: Prisma.JsonValue;
    chosenRouteId: string | null;
    form: {
        fields: Prisma.JsonValue;
        routes: Prisma.JsonValue;
    };
};
type VirtualQueuesDataType = {
    chosenRouteId: string;
    fieldOptionData: {
        fieldId: string;
        selectedOptionIds: string | number | string[];
    };
};
interface GetLuckyUserParams<T extends PartialUser> {
    availableUsers: [T, ...T[]];
    eventType: {
        id: number;
        isRRWeightsEnabled: boolean;
        team: {
            parentId?: number | null;
            rrResetInterval: RRResetInterval | null;
            rrTimestampBasis: RRTimestampBasis;
        } | null;
        includeNoShowInRRCalculation: boolean;
    };
    allRRHosts: {
        user: {
            id: number;
            email: string;
            credentials: CredentialForCalendarService[];
            userLevelSelectedCalendars: SelectedCalendar[];
        };
        createdAt: Date;
        weight?: number | null;
    }[];
    routingFormResponse: RoutingFormResponse | null;
    meetingStartTime?: Date;
}
export declare const getIntervalEndDate: ({ interval, rrTimestampBasis, meetingStartTime, }: {
    interval: RRResetInterval;
    rrTimestampBasis: RRTimestampBasis;
    meetingStartTime?: Date;
}) => Date;
export declare const getIntervalStartDate: ({ interval, rrTimestampBasis, meetingStartTime, }: {
    interval: RRResetInterval;
    rrTimestampBasis: RRTimestampBasis;
    meetingStartTime?: Date;
}) => Date;
type OOODataType = {
    userId: number;
    oooEntries: {
        start: Date;
        end: Date;
    }[];
}[];
type FetchedData = {
    bookingsOfNotAvailableUsersOfInterval: PartialBooking[];
    bookingsOfAvailableUsersOfInterval: PartialBooking[];
    allRRHostsBookingsOfInterval: PartialBooking[];
    allRRHostsCreatedInInterval: {
        userId: number;
        createdAt: Date;
    }[];
    organizersWithLastCreated: {
        id: number;
        bookings: {
            createdAt: Date;
        }[];
    }[];
    attributeWeights?: {
        userId: number;
        weight: number;
    }[] | null;
    virtualQueuesData?: VirtualQueuesDataType | null;
    oooData: OOODataType;
};
type AvailableUserBase = PartialUser & {
    priority: number | null;
    weight: number | null;
};
export interface ILuckyUserService {
    bookingRepository: BookingRepository;
    hostRepository: HostRepository;
    oooRepository: PrismaOOORepository;
    userRepository: UserRepository;
    attributeRepository: PrismaAttributeRepository;
}
export declare class LuckyUserService implements ILuckyUserService {
    bookingRepository: BookingRepository;
    hostRepository: HostRepository;
    oooRepository: PrismaOOORepository;
    userRepository: UserRepository;
    attributeRepository: PrismaAttributeRepository;
    constructor(deps: ILuckyUserService);
    private leastRecentlyBookedUser;
    private getHostsWithCalibration;
    private getUsersWithHighestPriority;
    private filterUsersBasedOnWeights;
    private getAverageAttributeWeights;
    private getAttributesForVirtualQueues;
    private getQueueAndAttributeWeightData;
    private getCalendarBusyTimesOfInterval;
    private getBookingsOfInterval;
    private fetchAllDataNeededForCalculations;
    getLuckyUser<T extends PartialUser & {
        priority?: number | null;
        weight?: number | null;
    }>(getLuckyUserParams: GetLuckyUserParams<T>): Promise<T>;
    getLuckyUser_requiresDataToBePreFetched<T extends PartialUser & {
        priority?: number | null;
        weight?: number | null;
    }>({ availableUsers, ...getLuckyUserParams }: GetLuckyUserParams<T> & FetchedData): {
        luckyUser: T;
        usersAndTheirBookingShortfalls: {
            id: number;
            bookingShortfall: number;
            calibration: number;
            weight: number;
        }[];
    };
    prepareQueuesAndAttributesData<T extends PartialUser>({ eventType, routingFormResponse, allRRHosts, }: Omit<GetLuckyUserParams<T>, "availableUsers">): Promise<{
        attributeWeights: {
            userId: number;
            weight: number;
        }[] | undefined;
        virtualQueuesData: {
            chosenRouteId: string;
            fieldOptionData: {
                fieldId: string;
                selectedOptionIds: string | number | string[];
            };
        } | undefined;
    }>;
    getOrderedListOfLuckyUsers<AvailableUser extends AvailableUserBase>(getLuckyUserParams: GetLuckyUserParams<AvailableUser>): Promise<{
        users: AvailableUser[];
        isUsingAttributeWeights: boolean;
        perUserData: {
            bookingsCount: Record<number, number>;
            bookingShortfalls: Record<number, number> | null;
            calibrations: Record<number, number> | null;
            weights: Record<number, number> | null;
        };
    }>;
}
export {};
//# sourceMappingURL=getLuckyUser.d.ts.map