
import { Key, ReactNode } from "react";

//#region src/components/overlays/Notifications/types.d.ts
type NotificationType = 'default' | 'success' | 'danger' | 'warning' | 'note';
interface NotificationBaseOptions {
  id?: Key;
  theme?: NotificationType;
  title?: ReactNode;
  description?: ReactNode;
  icon?: ReactNode;
}
interface OverlayNotificationOptions extends NotificationBaseOptions {
  mode?: 'overlay';
  /**
   * Action buttons rendered below the notification description.
   * A default "Dismiss" button is auto-appended unless any action has
   * `isDismiss` set (detected automatically via context).
   * When omitted, only the default "Dismiss" button is shown (if `isDismissible`).
   */
  actions?: ReactNode;
  /**
   * Whether the notification shows the default dismiss UI:
   * - Auto-appended "Dismiss" button (suppressed when false)
   * - Escape key dismissal (disabled when false)
   *
   * Actions with `closeOnPress` (default `true`) can still close the
   * notification regardless of this setting.
   *
   * Default: true
   */
  isDismissible?: boolean;
  /**
   * Duration in ms before auto-dismiss.
   * Default: 3000ms (non-persistent) or 5000ms (persistent).
   * null = no auto-dismiss.
   */
  duration?: number | null;
  /**
   * Whether to retain in persistent list when dismissed.
   * All user-visible dismissals (timeout, action, close) move the notification
   * to the persistent list. Only programmatic cleanup (`'api'`, e.g. component
   * unmount) skips persistence.
   *
   * Once archived, subsequent calls with the same `id` skip the overlay and
   * update the persistent list directly.
   *
   * Default: false
   */
  persistent?: boolean;
}
interface StoredNotificationOptions extends NotificationBaseOptions {
  mode: 'stored';
  /** Action buttons (same ReactNode format as overlay notifications) */
  actions?: ReactNode;
  /**
   * Timestamp (epoch ms) for when the notification was originally created.
   * Use this when restoring server-sourced notifications to preserve the original time.
   * Defaults to `Date.now()` if omitted.
   */
  createdAt?: number;
}
type NotificationOptions = OverlayNotificationOptions | StoredNotificationOptions;
type DismissReason = 'close' | 'timeout' | 'action' | 'api';
interface NotificationActionProps {
  /** Action label */
  children?: ReactNode;
  /**
   * Called when the action is pressed.
   * Return `false` to prevent the auto-dismiss that would normally follow.
   * Useful for async flows where the user may cancel (e.g. confirmation dialogs).
   */
  onPress?: () => void | false | Promise<void | false>;
  /** Whether to auto-dismiss the notification after onPress. Default: true */
  closeOnPress?: boolean;
  /** Whether the action is disabled */
  isDisabled?: boolean;
  /**
   * Marks this action as the notification's dismiss button.
   * Detected automatically via context — when any action in the notification
   * has `isDismiss` set, the auto-appended default "Dismiss" button is suppressed.
   */
  isDismiss?: boolean;
}
interface NotificationHandle {
  id: Key;
  dismiss: () => void;
}
interface NotificationsApi {
  notify: (options: NotificationOptions) => NotificationHandle;
  /**
   * Shorthand for `notify({ mode: 'stored', ... })`.
   * Stores a notification directly to the persistent list without showing an overlay.
   * Kept as a separate method to make the "stored-only" intent explicit at call sites.
   */
  record: (options: Omit<StoredNotificationOptions, 'mode'>) => NotificationHandle;
  dismiss: (id: Key) => void;
}
interface InternalNotification extends OverlayNotificationOptions {
  internalId: string;
  createdAt: number;
  updatedAt: number;
  isExiting?: boolean;
  ownerId?: string;
}
interface PersistentNotificationItem {
  id: Key;
  theme?: NotificationType;
  title?: ReactNode;
  description?: ReactNode;
  icon?: ReactNode;
  /** Action buttons (ReactNode) */
  actions?: ReactNode;
  createdAt: number;
  updatedAt: number;
  /** Whether the notification has been seen in the persistent list */
  isRead?: boolean;
  /** Owner ID for cleanup on hook/component unmount */
  ownerId?: string;
}
interface PersistentNotificationsListProps {
  onDismissItem?: (item: PersistentNotificationItem) => void;
  /** Called before any action's onPress handler fires. Useful for closing a parent popover. */
  onAction?: () => void;
  emptyState?: ReactNode;
}
interface OverlayProviderProps {
  children: ReactNode;
  /** Maximum number of persistent notifications to keep. Default: 200 */
  maxPersistentNotifications?: number;
}
interface NotificationProps extends OverlayNotificationOptions {}
//#endregion
export { DismissReason, InternalNotification, NotificationActionProps, NotificationBaseOptions, NotificationHandle, NotificationOptions, NotificationProps, NotificationType, NotificationsApi, OverlayNotificationOptions, OverlayProviderProps, PersistentNotificationItem, PersistentNotificationsListProps, StoredNotificationOptions };
//# sourceMappingURL=types.d.ts.map