import React from 'react';
import { QueryWindowReducer } from "./QueryWindow";
import { ArtistWindowReducer } from "./ArtistWindow";
import SearchIcon from '@material-ui/icons/Search';
import PersonIcon from '@material-ui/icons/Person';
import AlbumIcon from '@material-ui/icons/Album';
import LocalOfferIcon from '@material-ui/icons/LocalOffer';
import AudiotrackIcon from '@material-ui/icons/Audiotrack';
import { SongWindowReducer } from './SongWindow';
import { AlbumWindowReducer } from './AlbumWindow';
import { TagWindowReducer } from './TagWindow';

export enum WindowType {
    Query = "Query",
    Artist = "Artist",
    Album = "Album",
    Tag = "Tag",
    Song = "Song",
}

export interface WindowState {
    tabLabel: string,
}

export const newWindowReducer = {
    [WindowType.Query]: QueryWindowReducer,
    [WindowType.Artist]: ArtistWindowReducer,
    [WindowType.Album]: AlbumWindowReducer,
    [WindowType.Song]: SongWindowReducer,
    [WindowType.Tag]: TagWindowReducer,
}

export const newWindowState = {
    [WindowType.Query]: () => {
        return {
            tabLabel: <><SearchIcon/>Query</>,
            editingQuery: false,
            query: null,
            resultsForQuery: null,
        };
    },
    [WindowType.Artist]: () => {
        return {
            tabLabel: <><PersonIcon/>Artist</>,
            artistId: 1,
            metadata: null,
        }
    },
    [WindowType.Album]: () => {
        return {
            tabLabel: <><AlbumIcon/>Album</>,
            albumId: 1,
            metadata: null,
        }
    },
    [WindowType.Song]: () => {
        return {
            tabLabel: <><AudiotrackIcon/>Song</>,
            songId: 1,
            metadata: null,
        }
    },
    [WindowType.Tag]: () => {
        return {
            tabLabel: <><LocalOfferIcon/>Tag</>,
            tagId: 1,
            metadata: null,
        }
    },
}