import { DownloadState } from '@/types/download'; import { DownloadConfiguration } from '@/types/settings'; import { RawVideoInfo } from '@/types/video'; import { createContext, useContext } from 'react'; interface AppContextType { fetchVideoMetadata: (url: string, formatId?: string, playlistIndex?: string, selectedSubtitles?: string | null, resumeState?: DownloadState, downloadConfig?: DownloadConfiguration) => Promise; startDownload: (url: string, selectedFormat: string, downloadConfig: DownloadConfiguration, selectedSubtitles?: string | null, resumeState?: DownloadState, playlistItems?: string) => Promise; pauseDownload: (state: DownloadState) => Promise; resumeDownload: (state: DownloadState) => Promise; cancelDownload: (state: DownloadState) => Promise; } export const AppContext = createContext({ fetchVideoMetadata: async () => (null), startDownload: async () => {}, pauseDownload: async () => {}, resumeDownload: async () => {}, cancelDownload: async () => {} }); export const useAppContext = () => useContext(AppContext);