import { OnDestroy } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable, Subscription } from 'rxjs';
import { UserIdService } from '../../auth/index';
import { Cart } from '../../model/cart.model';
import { User } from '../../model/misc.model';
import { OrderEntry } from '../../model/order.model';
import { ProcessesLoaderState } from '../../state/utils/processes-loader/processes-loader-state';
import { StateWithMultiCart } from '../store/multi-cart-state';
import { MultiCartService } from './multi-cart.service';
export declare class ActiveCartService implements OnDestroy {
    protected store: Store<StateWithMultiCart>;
    protected multiCartService: MultiCartService;
    protected userIdService: UserIdService;
    protected activeCart$: Observable<Cart>;
    protected subscription: Subscription;
    protected activeCartId$: Observable<string>;
    protected cartSelector$: Observable<ProcessesLoaderState<Cart>>;
    constructor(store: Store<StateWithMultiCart>, multiCartService: MultiCartService, userIdService: UserIdService);
    ngOnDestroy(): void;
    protected initActiveCart(): void;
    /**
     * Returns active cart
     */
    getActive(): Observable<Cart>;
    /**
     * Returns active cart id
     */
    getActiveCartId(): Observable<string>;
    /**
     * Returns cart entries
     */
    getEntries(): Observable<OrderEntry[]>;
    /**
     * Returns last cart entry for provided product code.
     * Needed to cover processes where multiple entries can share the same product code
     * (e.g. promotions or configurable products)
     *
     * @param productCode
     */
    getLastEntry(productCode: string): Observable<OrderEntry>;
    /**
     * Returns cart loading state
     */
    getLoading(): Observable<boolean>;
    /**
     * Returns true when cart is stable (not loading and not pending processes on cart)
     */
    isStable(): Observable<boolean>;
    /**
     * Loads cart or upon login, whenever there's an existing cart, merge it into the current user cart
     * cartId will be defined (not '', null, undefined)
     */
    protected loadOrMerge(cartId: string, userId: string, previousUserId: string): void;
    /**
     * Loads cart in every case apart from anonymous user and current cart combination
     */
    protected load(cartId: string, userId: string): void;
    /**
     * Adds entries from guest cart to user cart
     */
    protected addEntriesGuestMerge(cartEntries: OrderEntry[]): void;
    /**
     * Helper method for requiring loaded cart that is not a guest cart (guest cart is filtered out).
     * Used when merging guest cart with user cart.
     */
    protected requireLoadedCartForGuestMerge(): Observable<ProcessesLoaderState<Cart>>;
    protected isCartCreating(cartState: ProcessesLoaderState<Cart>, cartId: string): boolean;
    requireLoadedCart(customCartSelector$?: Observable<ProcessesLoaderState<Cart>>): Observable<ProcessesLoaderState<Cart>>;
    /**
     * Add entry to active cart
     *
     * @param productCode
     * @param quantity
     */
    addEntry(productCode: string, quantity: number): void;
    /**
     * Remove entry
     *
     * @param entry
     */
    removeEntry(entry: OrderEntry): void;
    /**
     * Update entry
     *
     * @param entryNumber
     * @param quantity
     */
    updateEntry(entryNumber: number, quantity: number): void;
    /**
     * Returns cart entry
     *
     * @param productCode
     */
    getEntry(productCode: string): Observable<OrderEntry>;
    /**
     * Assign email to cart
     *
     * @param email
     */
    addEmail(email: string): void;
    /**
     * Get assigned user to cart
     */
    getAssignedUser(): Observable<User>;
    /**
     * Returns true for guest cart
     */
    isGuestCart(cart?: Cart): boolean;
    /**
     * Add multiple entries to a cart
     *
     * @param cartEntries : list of entries to add (OrderEntry[])
     */
    addEntries(cartEntries: OrderEntry[]): void;
    /**
     * Indicates if given string is matching email pattern
     */
    protected isEmail(str: string): boolean;
    /**
     * Temporary method to merge guest cart with user cart because of backend limitation
     * This is for an edge case
     */
    protected guestCartMerge(cartId: string): void;
    /**
     * Indicates if given cart is empty.
     * Returns true is cart is undefined, null or is an empty object.
     */
    protected isEmpty(cart: Cart): boolean;
    /**
     * Indicates if a given user is logged in on account different than preceding user account
     */
    protected isJustLoggedIn(userId: string, previousUserId: string): boolean;
}
