import React, { createContext, useContext } from 'react';

export interface Toast {
    id: string;
    message: string;
    type: 'warning' | 'error' | 'success' | 'info';
}

export interface ToastContextType {
    showToast: (message: string, type?: Toast['type']) => void;
    showGuestWarning: () => void;
}

export const ToastContext = createContext<ToastContextType | undefined>(undefined);

export const useToast = () => {
    const context = useContext(ToastContext);
    if (!context) {
        throw new Error('useToast must be used within a ToastProvider');
    }
    return context;
};
