import { useCallback, useState } from 'react';

export type StatusVariant = 'info' | 'success' | 'error';

export interface StatusMessage {
  message: string;
  variant: StatusVariant;
}

export const useDocumentsStore = () => {
  const [status, setStatus] = useState<StatusMessage | null>(null);

  const setStatusMessage = useCallback((message?: string | null, variant: StatusVariant = 'info') => {
    setStatus(message ? { message, variant } : null);
  }, []);

  return { status, setStatusMessage };
};

export default useDocumentsStore;
