import { FC } from 'react';
import classnames from 'classnames';
import { Modal, Text } from '@servicetitan/design-system';

import { Header } from './header';
import { Row, RiskType } from './row';

import * as Styles from './result-definitions-modal.module.less';

interface ResultDefinitionsModalProps {
    onClose(): void;
}

export const ResultDefinitionsModal: FC<ResultDefinitionsModalProps> = ({ onClose }) => (
    <Modal
        open
        closable
        title="Email Validation Result Definitions"
        onClose={onClose}
        className={classnames(Styles.modal, 'qa-result-definitions-modal')}
    >
        <Header />
        <div className={Styles.wall} />
        <Row result="Undeliverable" risk={RiskType.VeryHigh} recommendation="Suppress" />
        <hr className={Styles.divider} />
        <Text size={2} className="m-y-2">
            Address was determined invalid after performing multiple checks including MX, SMTP,
            etc., likely due to:
            <ul className="m-y-0">
                <li>The receiving recipient domain is not configured to accept email</li>
                <li>
                    The SMTP commands issued resulted in a hard bounce, i.e., "user does not exist"
                    or "mailbox full" errors
                </li>
                <li>
                    The recipient address historically hard-bounced or appeared on suppression lists
                </li>
                <li>
                    Mailbox providers require specific standard for an email address including
                    min/max number of characters, max number of periods, etc.
                </li>
            </ul>
        </Text>
        <hr className={Styles.divider} />
        <Row result="Risky" risk={RiskType.Medium} recommendation="Proceed With Caution" />
        <hr className={Styles.divider} />
        <Text size={2} className="m-y-2">
            Address was determined risky based on historical analysis or problematic results, likely
            due to:
            <ul className="m-y-0">
                <li>
                    The receiving address may be valid, but was found on one or more suppression
                    lists Addresses matching a known spam trap are not ideal for sending campaigns
                    to and can impact reputation
                </li>
            </ul>
        </Text>
        <hr className={Styles.divider} />
        <Row result="Typo" risk={RiskType.High} recommendation="Suppress" />
        <hr className={Styles.divider} />
        <Text size={2} className="m-y-2">
            Address was possibly typed incorrectly during sign-up, or matches known typo domains,
            likely due to:
            <ul className="m-y-0">
                <li>
                    Typos are mistyped address domains like "gmil.com" instead of "gmail.com," and
                    are often undeliverable. Address is checked against database of common domain
                    misspellings. These kinds of addresses are usually not good for sending.
                </li>
            </ul>
        </Text>
        <hr className={Styles.divider} />
        <Row result="Accept-All" risk={RiskType.Medium} recommendation="Proceed With Caution" />
        <hr className={Styles.divider} />
        <Text size={2} className="m-y-2">
            The receiving domain of the address accepts all mail, indicating it may be a spam trap,
            likely due to:
            <ul className="m-y-0">
                <li>
                    Some domains do not distinguish between existing and non-existing addresses and
                    accept all mail
                </li>
            </ul>
        </Text>
        <hr className={Styles.divider} />
        <Row result="Dispose" risk={RiskType.Medium} recommendation="Proceed With Caution" />
        <hr className={Styles.divider} />
        <Text size={2} className="m-y-2">
            The receiving domain of the address accepts all mail, indicating it may be a spam trap,
            likely due to:
            <ul className="m-y-0">
                <li>
                    Some domains do not distinguish between existing and non-existing addresses and
                    accept all mail
                </li>
            </ul>
        </Text>
        <hr className={Styles.divider} />
        <Row result="Role" risk={RiskType.Medium} recommendation="Proceed With Caution" />
        <hr className={Styles.divider} />
        <Text size={2} className="m-y-2">
            Address likely is not a particular person, but rather a group or department, likely due
            to:
            <ul className="m-y-0">
                <li>
                    Role addresses belong to the end user and are deliverable, but include multiple
                    end recipients as part of a larger distribution list. These kinds of addreses
                    are usually not good for sending campaigns
                </li>
            </ul>
        </Text>
        <hr className={Styles.divider} />
        <Row result="Unknown" risk={RiskType.Medium} recommendation="Proceed With Caution" />
        <hr className={Styles.divider} />
        <Text size={2} className="m-y-2">
            A connection problem or unresponsive SMTP server prevented validation, likely due to:
            <ul className="m-y-0">
                <li>Unable to connect and resolve to service during SMTP connection</li>
                <li>Unable to successfully get a response from SMTP server</li>
                <li>
                    Address was outside known result definitions and criteria and was unable to be
                    classified
                </li>
            </ul>
        </Text>
    </Modal>
);
