import {Nudge} from "../../core/repositories/nudges/typings";

export declare interface NotificationDispatcher {
    on<U extends keyof CfNotificationEvents>(
        event: U, listener: CfNotificationEvents[U]
    ): this;

    emit<U extends keyof CfNotificationEvents>(
        event: U, ...args: Parameters<CfNotificationEvents[U]>
    ): boolean;
}

export enum NotificationAction {
    Shown = 'shown',
    Error = 'error',
    Block = 'block',
    Discard = 'discard',
    Open = 'open',
    Expired = "expired"
}

export interface CfNotificationEvents {
    [NotificationAction.Shown]: (id: number) => void;
    [NotificationAction.Block]: (id: number) => void;
    [NotificationAction.Discard]: (id: number) => void;
    [NotificationAction.Open]: (id: number) => void;
    [NotificationAction.Expired]: (id: number) => void;
}

export interface NotificationDispatcher {
    show(nudge: Nudge, id: number)
}
