import { notification } from 'antd';
import { ReactNode } from 'react';

notification.config({
  duration: 1.5,
});

export function notificationSuccess(content?: ReactNode | any): void {
  notification.success({
    message: 'Success',
    description: content,
    className: 'no-print',
  });
}

export function notificationError(content?: ReactNode | any): void {
  notification.error({
    message: 'Error',
    description: content,
    className: 'no-print',
  });
}

export function notificationWarning(content?: ReactNode | any): void {
  notification.warning({
    message: 'Warning',
    description: content,
    className: 'no-print',
  });
}

export function notificationInfo(content?: ReactNode | any): void {
  notification.info({
    message: 'Info',
    description: content,
    className: 'no-print',
  });
}

interface MultiNotificationParams {
  success?: string[];
  failed?: string[];
  warning?: string[];
  info?: string[];
}

export function multiNotification(message: MultiNotificationParams) {
  const { success = [], failed = [], warning = [], info = [] } = message;
  success.forEach((item) => notificationSuccess(item));
  failed.forEach((item) => notificationError(item));
  warning.forEach((item) => notificationWarning(item));
  info.forEach((item) => notificationInfo(item));
}
