import React = require('react');
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tooltip } from '@material-ui/core';
import { observer } from 'mobx-react';
import { unimplementedFunction } from '../../../../Utils';
import { DocumentType } from '../../../documents/DocumentTypes';
import { SelectionManager } from '../../../util/SelectionManager';
import { AntimodeMenu, AntimodeMenuProps } from '../../AntimodeMenu';

@observer
export class MarqueeOptionsMenu extends AntimodeMenu<AntimodeMenuProps> {
    static Instance: MarqueeOptionsMenu;

    public createCollection: (e: KeyboardEvent | React.PointerEvent | undefined, group?: boolean) => void = unimplementedFunction;
    public delete: (e: KeyboardEvent | React.PointerEvent | undefined) => void = unimplementedFunction;
    public summarize: (e: KeyboardEvent | React.PointerEvent | undefined) => void = unimplementedFunction;
    public showMarquee: () => void = unimplementedFunction;
    public hideMarquee: () => void = unimplementedFunction;
    public pinWithView: (e: KeyboardEvent | React.PointerEvent | undefined) => void = unimplementedFunction;
    public isShown = () => this._opacity > 0;
    constructor(props: Readonly<{}>) {
        super(props);

        MarqueeOptionsMenu.Instance = this;
    }

    render() {
        const presPinWithViewIcon = <img src="/assets/pinWithView.png" style={{ margin: 'auto', width: 19, transform: 'translate(-2px, -2px)' }} />;
        const buttons = [
            <Tooltip key="collect" title={<div className="dash-tooltip">Create a Collection</div>} placement="bottom">
                <button className="antimodeMenu-button" onPointerDown={this.createCollection}>
                    <FontAwesomeIcon icon="object-group" size="lg" />
                </button>
            </Tooltip>,
            <Tooltip key="group" title={<div className="dash-tooltip">Create a Grouping</div>} placement="bottom">
                <button className="antimodeMenu-button" onPointerDown={e => this.createCollection(e, true)}>
                    <FontAwesomeIcon icon="layer-group" size="lg" />
                </button>
            </Tooltip>,
            <Tooltip key="summarize" title={<div className="dash-tooltip">Summarize Documents</div>} placement="bottom">
                <button className="antimodeMenu-button" onPointerDown={this.summarize}>
                    <FontAwesomeIcon icon="compress-arrows-alt" size="lg" />
                </button>
            </Tooltip>,
            <Tooltip key="delete" title={<div className="dash-tooltip">Delete Documents</div>} placement="bottom">
                <button className="antimodeMenu-button" onPointerDown={this.delete}>
                    <FontAwesomeIcon icon="trash-alt" size="lg" />
                </button>
            </Tooltip>,
            <Tooltip key="pinWithView" title={<div className="dash-tooltip">Pin selected region to trail</div>} placement="bottom">
                <button className="antimodeMenu-button" onPointerDown={this.pinWithView}>
                    {presPinWithViewIcon}
                </button>
            </Tooltip>,
        ];
        return this.getElement(buttons);
    }
}
