import { AXPEntity, AXPFileStorageInfo, AXPMenuProvider, AXPMenuProviderContext, AXPSettingDefinitionProvider, AXPSettingDefinitionProviderContext } from '@acorex/platform/common';
import * as i0 from '@angular/core';
import { Injector, InputSignal, OutputEmitterRef, Type, InjectionToken, OnInit, OnDestroy } from '@angular/core';
import { AXPEntityModel, AXMEntityCrudServiceImpl } from '@acorex/platform/layout/entity';
import { AXPExecuteCommand, AXPContent, AXPUserReference, AXPQueryRequest, AXPPagedListResult } from '@acorex/platform/core';
import * as i1 from '@acorex/platform/layout/components';
import * as i2 from '@acorex/platform/layout/widget-core';
import { AXPValueWidgetComponent, AXPWidgetConfig } from '@acorex/platform/layout/widget-core';
import { AXTabStripChangedEvent } from '@acorex/components/tabs';

declare const RootConfig: {
    config: {
        i18n: string;
        route: string;
    };
    module: {
        route: string;
        name: string;
        title: string;
        icon: string;
    };
    entities: {
        channel: {
            name: string;
            title: string;
            icon: string;
        };
        template: {
            name: string;
            title: string;
            icon: string;
        };
        notification: {
            name: string;
            title: string;
            icon: string;
        };
    };
};

declare function notificationEntityFactory(injector: Injector): Promise<AXPEntity | null>;

type AXMNotificationType = 'File' | 'Chat' | 'Comment' | 'Log';
/**
 * Interface for dynamic notification content components.
 * Ensures that any component used for notification content has a consistent API.
 */
interface AXPNotificationContent {
    item: InputSignal<AXMNotificationItem | undefined>;
    execute: OutputEmitterRef<AXPExecuteCommand>;
}
declare abstract class AXPNotificationDefinitionProvider {
    name: AXMNotificationType;
    title: string;
    icon: string;
    content?: () => Promise<Type<AXPNotificationContent>>;
    execute: (command: AXPExecuteCommand, item: AXMNotificationItem) => Promise<void>;
}
declare class AXPNotificationDefinitionProviderDefault extends AXPNotificationDefinitionProvider {
    provide(): Promise<AXPNotificationDefinitionProvider[]>;
}
declare const AXP_NOTIFICATION_DEFINITION_PROVIDER: InjectionToken<AXPNotificationDefinitionProvider[]>;
declare class AXPNotificationDefinitionService {
    private providers;
    getProviders(): AXPNotificationDefinitionProvider[];
    resolve(name: string): AXPNotificationDefinitionProvider | null;
    execute(command: AXPExecuteCommand, item: AXMNotificationItem): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPNotificationDefinitionService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPNotificationDefinitionService>;
}

type AXMNotificationChannel = 'InApp' | 'Email' | 'SMS';
type AXMNotificationCategory = 'Inbox' | 'Archive';
type AXMNotificationPrority = 'Warning' | 'Danger' | 'Notice';
type AXMNotificationActionType = 'Link' | 'Entity' | 'Popup';
interface AXMNotificationItem {
    id: string;
    title: string;
    body: string;
    type: AXMNotificationType;
    channel: AXMNotificationChannel;
    content: AXPContent;
    action?: {
        type: AXMNotificationActionType;
        data: Record<string, unknown>;
    };
    receiver: AXPUserReference;
    sender: AXPUserReference;
    template: {
        category: AXMNotificationCategory;
        prority: AXMNotificationPrority;
        icon: string;
        isPinned: boolean;
    };
    readAt: Date | null;
    createAt: Date;
    entityName: 'notifications';
    data?: Record<string, unknown>;
}
interface AXMNotificationResponse {
    total: number;
    items: AXMNotificationItem[];
}
interface AXMNotificationMarkAsReadRequest {
    id: string[];
}

interface AXMNotificationManagementNotificationEntityModel extends AXPEntityModel<string> {
    name: string;
    title: string;
    readAt?: Date;
}

declare abstract class AXMNotificationEntityService extends AXMEntityCrudServiceImpl<string, AXMNotificationManagementNotificationEntityModel, AXMNotificationItem> {
    abstract getList(): Promise<AXMNotificationResponse>;
    abstract markAsRead(payload?: AXMNotificationMarkAsReadRequest): Promise<void>;
    abstract markAllAsRead(): Promise<void>;
    abstract create(payload?: AXMNotificationItem): Promise<AXMNotificationItem>;
}
declare class AXMNotificationEntityServiceImpl extends AXMNotificationEntityService {
    getList(): Promise<AXMNotificationResponse>;
    markAsRead(payload?: AXMNotificationMarkAsReadRequest): Promise<void>;
    markAllAsRead(): Promise<void>;
    create(payload?: AXMNotificationItem): Promise<AXMNotificationItem>;
    constructor();
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationEntityServiceImpl, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXMNotificationEntityServiceImpl>;
}

declare function notificationTemplateEntityFactory(injector: Injector): Promise<AXPEntity | null>;

declare class AXMNotificationTemplateEntityModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationTemplateEntityModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<AXMNotificationTemplateEntityModule, never, never, never>;
    static ɵinj: i0.ɵɵInjectorDeclaration<AXMNotificationTemplateEntityModule>;
}

interface AXMNotificationManagementTemplateEntityModel extends AXPEntityModel<string> {
    name: string;
    title: string;
    description: string;
    icon?: string;
}

declare abstract class AXMNotificationManagementTemplateEntityService extends AXMEntityCrudServiceImpl<string, AXMNotificationManagementTemplateEntityModel> {
}
declare class AXMNotificationManagementTemplateEntityServiceImpl extends AXMNotificationManagementTemplateEntityService {
    constructor();
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationManagementTemplateEntityServiceImpl, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXMNotificationManagementTemplateEntityServiceImpl>;
}

declare function notificationChannelEntityFactory(injector: Injector): Promise<AXPEntity | null>;

interface AXMNotificationManagementChannelEntityModel extends AXPEntityModel<string> {
    name: string;
    title: string;
    body: string;
    description: string;
    icon?: string;
    type: AXMSelectModel;
    imageId?: string;
    image?: AXPFileStorageInfo;
    channel: AXMSelectModel;
    pin?: boolean;
    contentType?: AXMSelectModel;
    shape?: AXMSelectModel;
    placement?: AXMSelectModel;
}
interface AXMSelectModel {
    name: string;
    title: string;
}

declare abstract class AXMNotificationManagementChannelEntityService extends AXMEntityCrudServiceImpl<string, AXMNotificationManagementChannelEntityModel> {
}
declare class AXMNotificationManagementChannelEntityServiceImpl extends AXMNotificationManagementChannelEntityService {
    constructor();
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationManagementChannelEntityServiceImpl, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXMNotificationManagementChannelEntityServiceImpl>;
}

declare class AXMNotificationEntityModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationEntityModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<AXMNotificationEntityModule, never, never, never>;
    static ɵinj: i0.ɵɵInjectorDeclaration<AXMNotificationEntityModule>;
}

declare class AXMNotificationChannelEntityModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationChannelEntityModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<AXMNotificationChannelEntityModule, never, never, never>;
    static ɵinj: i0.ɵɵInjectorDeclaration<AXMNotificationChannelEntityModule>;
}

declare class AXMMenuProvider implements AXPMenuProvider {
    private entityService;
    private sessionService;
    provide(context: AXPMenuProviderContext): Promise<void>;
}

declare class AXMNotificationManagementModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationManagementModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<AXMNotificationManagementModule, never, [typeof i1.AXPComponentSlotModule, typeof i2.AXPWidgetCoreModule, typeof AXMNotificationEntityModule, typeof AXMNotificationTemplateEntityModule, typeof AXMNotificationChannelEntityModule], never>;
    static ɵinj: i0.ɵɵInjectorDeclaration<AXMNotificationManagementModule>;
}

declare class AXMSettingProvider implements AXPSettingDefinitionProvider {
    private injector;
    private readonly translateService;
    constructor(injector: Injector);
    provide(context: AXPSettingDefinitionProviderContext): Promise<void>;
}

declare function myNotificationEntityFactory(injector: Injector): Promise<AXPEntity | null>;

declare function notificationLogEntityFactory(injector: Injector): Promise<AXPEntity | null>;

/**
 * Extends standard NotificationOptions to include a click handler and window focusing behavior.
 */
interface AXMOsNotificationOptions extends NotificationOptions {
    onClick?: () => void;
    activeWindow?: boolean;
}
/**
 * Service to display OS-level notifications using the browser's Notification API.
 */
declare class AXMOsNotificationService {
    readonly isSupported: i0.WritableSignal<boolean>;
    readonly permission: i0.WritableSignal<boolean>;
    constructor();
    /**
     * Requests permission from the user to display desktop notifications.
     * @returns A promise that resolves to true if permission is granted, false otherwise.
     */
    requestPermission(): Promise<boolean>;
    /**
     * Shows a desktop notification.
     * This method should be called after ensuring permission has been granted via requestPermission().
     *
     * @param title The title of the notification.
     * @param options Optional notification options including an onClick handler and window focusing.
     * @returns The Notification object if displayed, otherwise null.
     */
    show(title: string, options?: AXMOsNotificationOptions): Notification | null;
    /**
     * Dismisses all active notifications or a specific one.
     * @param notification Optional. Pass a specific notification to close it; otherwise closes all.
     */
    dismiss(notification?: Notification): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMOsNotificationService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXMOsNotificationService>;
}

/**
 * Signal store that provides a reactive interface for notification-related operations
 * Acts as a layer between notification components and the entity service
 */
declare class AXMNotificationConnectorService {
    private readonly notificationService;
    private readonly osNotificationService;
    private readonly isLoading;
    private readonly error;
    private readonly notifications;
    private readonly totalCount;
    readonly loading: i0.Signal<boolean>;
    readonly errorMessage: i0.Signal<string | null>;
    readonly notificationList: i0.Signal<AXMNotificationItem[]>;
    readonly total: i0.Signal<number>;
    readonly unreadCount: i0.Signal<number>;
    constructor();
    /**
     * Get list of notifications
     */
    getList(): Promise<AXMNotificationResponse>;
    /**
     * Mark notifications as read
     * If no specific IDs are provided, mark all unread notifications as read
     * If specific IDs are provided, set readAt only when it is currently null (no toggling)
     */
    markAsRead(payload?: AXMNotificationMarkAsReadRequest): Promise<void>;
    markAllAsRead(): Promise<void>;
    /**
     * Create a new notification
     */
    create(payload?: AXMNotificationItem, options?: AXMOsNotificationOptions): Promise<void>;
    /**
     * Insert one notification
     */
    insertOne(request: Omit<AXMNotificationManagementNotificationEntityModel, 'id'>): Promise<string>;
    /**
     * Get one notification by id
     */
    getOne(id: string): Promise<AXMNotificationManagementNotificationEntityModel>;
    /**
     * Delete one notification
     */
    deleteOne(id: string): Promise<void>;
    /**
     * Update one notification
     */
    updateOne(id: string, values: Partial<AXMNotificationManagementNotificationEntityModel>): Promise<AXMNotificationManagementNotificationEntityModel>;
    /**
     * Query notifications
     */
    query(request?: AXPQueryRequest): Promise<AXPPagedListResult<AXMNotificationItem>>;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXMNotificationConnectorService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXMNotificationConnectorService>;
}

/**
 * Notification Widget Component
 * Displays notifications in a card with tabs
 */
declare class AXPNotificationWidgetViewComponent extends AXPValueWidgetComponent<any> implements OnInit, OnDestroy {
    notificationClick: i0.OutputEmitterRef<AXMNotificationItem>;
    markAsRead: i0.OutputEmitterRef<AXMNotificationItem>;
    private readonly cdr;
    private readonly datePipe;
    private readonly notificationConnector;
    private readonly toastService;
    protected activeTab: i0.WritableSignal<"all" | "unread">;
    private refreshTimerId;
    protected readonly maxItems: i0.Signal<any>;
    protected readonly showAvatar: i0.Signal<any>;
    protected readonly showDate: i0.Signal<any>;
    protected readonly autoRefresh: i0.Signal<any>;
    protected readonly refreshInterval: i0.Signal<number>;
    protected readonly notifications: i0.Signal<AXMNotificationItem[]>;
    protected readonly totalNotifications: i0.Signal<number>;
    protected readonly isLoading: i0.Signal<boolean>;
    protected readonly notificationItems: i0.Signal<AXMNotificationItem[]>;
    constructor();
    ngOnInit(): void;
    ngOnDestroy(): void;
    /**
     * Set up auto-refresh timer based on configuration
     */
    private setupAutoRefresh;
    /**
     * Clear the refresh timer if it exists
     */
    private clearRefreshTimer;
    /**
     * Load notifications data from service
     */
    private loadNotifications;
    /**
     * Manually refresh notifications
     */
    protected refreshNotifications(): void;
    /**
     * Get the count of new messages for the badge
     */
    protected getNewMessageCount(): number;
    /**
     * Handle tab change event from ax-tabs component
     * @param data The tab change event data
     */
    protected handleTabChange(data: AXTabStripChangedEvent): void;
    /**
     * Mark all notifications as read
     */
    protected markAllAsRead(): Promise<void>;
    /**
     * Change the active tab
     */
    protected onTabChange(tabName: 'unread' | 'all'): void;
    /**
     * Handle notification click event
     */
    protected onNotificationClick(notification: AXMNotificationItem): void;
    /**
     * Bridge click from admin item (emits notification id)
     */
    protected onAdminItemClick: (id: string) => void;
    /**
     * Format the timestamp in a user-friendly way
     */
    protected formatTime(date: Date | string | undefined): string;
    /**
     * Mark notification as read if needed
     */
    private markAsReadIfNeeded;
    /**
     * Calculate days difference from now
     */
    private getDaysDifference;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPNotificationWidgetViewComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AXPNotificationWidgetViewComponent, "ng-component", never, {}, { "notificationClick": "notificationClick"; "markAsRead": "markAsRead"; }, never, never, true, never>;
}

/**
 * Configuration for the Notification Widget
 */
declare const AXPMyNotificationDashboardWidget: AXPWidgetConfig;

export { AXMMenuProvider, AXMNotificationChannelEntityModule, AXMNotificationConnectorService, AXMNotificationEntityModule, AXMNotificationEntityService, AXMNotificationEntityServiceImpl, AXMNotificationManagementChannelEntityService, AXMNotificationManagementChannelEntityServiceImpl, AXMNotificationManagementModule, AXMNotificationManagementTemplateEntityService, AXMNotificationManagementTemplateEntityServiceImpl, AXMNotificationTemplateEntityModule, AXMOsNotificationService, AXMSettingProvider, AXPMyNotificationDashboardWidget, AXPNotificationDefinitionProvider, AXPNotificationDefinitionProviderDefault, AXPNotificationDefinitionService, AXPNotificationWidgetViewComponent, AXP_NOTIFICATION_DEFINITION_PROVIDER, RootConfig, myNotificationEntityFactory, notificationChannelEntityFactory, notificationEntityFactory, notificationLogEntityFactory, notificationTemplateEntityFactory };
export type { AXMNotificationActionType, AXMNotificationCategory, AXMNotificationChannel, AXMNotificationItem, AXMNotificationManagementChannelEntityModel, AXMNotificationManagementNotificationEntityModel, AXMNotificationManagementTemplateEntityModel, AXMNotificationMarkAsReadRequest, AXMNotificationPrority, AXMNotificationResponse, AXMNotificationType, AXMOsNotificationOptions, AXMSelectModel, AXPNotificationContent };
