import React from 'react';

interface SingleAudioValue {
  playingId?: string;
  setPlayingId?: (playingId: string) => void;
}

export const SingleAudioContext: React.Context<SingleAudioValue> = React.createContext(
  {},
);

const SingleAudio: React.FC = props => {
  const { children } = props;
  const [playingId, setPlayingId] = React.useState<string>();
  return (
    <SingleAudioContext.Provider value={{ playingId, setPlayingId }}>
      {children}
    </SingleAudioContext.Provider>
  );
};

export default SingleAudio;
