// Desc: Custom hook to handle window resizing

export enum ElectronTheme {
    SYSTEM = 'system',
    DARK = 'dark',
    LIGHT = 'light'
}

const useWindow = () => {

    const setSize = (width : number, height : number) => {
        window.api.send('window-resize', { width: width, height: height });
    }

    const setResizeble = (isResizeble : boolean) => {
        window.api.send('window-resizeble', isResizeble);
    }

    const setTheme = (theme : ElectronTheme) => {
        window.api.send('window-theme', theme);
    }

    const setWindowPriority = (isTop: boolean) => {
        if(isTop){
            window.api.invoke('window-top');
        } else {
            window.api.invoke('window-priority-normal');
        }
    }

    return {
        setSize,
        setResizeble,
        setTheme,
        setWindowPriority
    }
}

export default useWindow;