import { createContext } from 'react';

export type GridType = {
  filePath: string;
  fileError: boolean;
  width: number;
  realWidth: number;
  height: number;
  duration: number;
  row: number;
  col: number;
};

export type SinglePlaylistType = {
  id: string;
  name: string;
  duration: number;
  currentTime: number;
  sumTime: number;
  play: boolean;
  error: boolean;
  grid: GridType[];
};

export interface PlaylistContextInterface {
  playlist: SinglePlaylistType[];
  setPlaylist: (playlist: SinglePlaylistType[]) => void;
}

export const InitConfig: SinglePlaylistType[] = [
  // { id: 'row-1', name: 'row-1', duration: 15, currentTime: 0, sumTime: 0, play: true, grid: []},
];

export const InitPlaylistContext: PlaylistContextInterface = {
  playlist: InitConfig,
  // eslint-disable-next-line no-void
  setPlaylist: () => void 0,
};

export const PlaylistContext = createContext<PlaylistContextInterface>(
  InitPlaylistContext
);
