import type { Connection, FilterQuery } from 'mongoose';
import { IReservationPackage, ISubReservation } from './mongoose/schemas/pendingReservation';
import { AbstractStockHolderRepo, IGetHolderResult, ILockKey, IOffer, IUnlockKey } from './stockHolderAbstract';
interface ISearchConditions {
    limit?: number;
    page?: number;
    project?: {
        id?: {
            $eq?: string;
        };
    };
    provider?: {
        id?: {
            $eq?: string;
        };
    };
    reservationFor?: {
        id?: {
            $eq?: string;
        };
    };
    reservationNumber?: {
        $eq?: string;
    };
    subReservation?: {
        identifier?: {
            $eq?: string;
        };
    };
}
type IProjectFieldResult = Pick<IReservationPackage, 'bookingTime' | 'numSeats' | 'dateCreated' | 'dateModified' | 'expires' | 'reservationFor' | 'reservationNumber' | 'typeOf'>;
type IProjectSubReservationResult = Pick<ISubReservation, 'identifier'> & {
    index: number;
};
/**
 * 保留予約リポジトリ
 */
export declare class PendingReservationRepo implements AbstractStockHolderRepo {
    private readonly pendingReservationModel;
    constructor(connection: Connection);
    static CREATE_FILTER_QUERY(params: ISearchConditions): FilterQuery<IReservationPackage>[];
    private static offer2identifier;
    private static lockKey2reservationPackage;
    lockIfNotLimitExceeded(lockKey: ILockKey, maximumReservationCount: number): Promise<void>;
    lock(lockKey: ILockKey): Promise<void>;
    unlock(params: IUnlockKey): Promise<void>;
    /**
     * 現時点での保留予約数を集計する
     */
    countUnavailableOffers(params: {
        project: {
            id: string;
        };
        event: {
            id: string;
            startDate: Date;
            hasTicketedSeat: boolean;
        };
    }): Promise<number>;
    getHolder(params: Omit<IUnlockKey, 'holder'>): Promise<string | null | undefined>;
    searchHolders(params: {
        project: {
            id: string;
        };
        eventId: string;
        startDate: Date;
        hasTicketedSeat: boolean;
        offers: IOffer[];
    }): Promise<IGetHolderResult[]>;
    docExists(params: {
        eventId: string;
    }): Promise<boolean>;
    deleteExpiredMany(params: {
        expires: {
            $lte: Date;
        };
    }): Promise<import("mongodb").DeleteResult>;
    projectFields(params: ISearchConditions): Promise<IProjectFieldResult[]>;
    projectSubReservationByReservationNumber(params: {
        project: {
            id: {
                $eq: string;
            };
        };
        reservationNumber: {
            $eq: string;
        };
    }): Promise<IProjectSubReservationResult[]>;
    /**
     * expiresを最新の情報に同期する
     */
    syncEvent2expires(params: {
        expires: Date;
        reservationFor: {
            id: string;
        };
    }): Promise<import("mongoose").UpdateWriteOpResult>;
    private aggregateNumSeats;
    private createReservationPackageIfPossible;
    private deleteReservationPackage;
    private deleteReservationIfExists;
}
export {};
