// @ts-check

var config = require("../config")
var utils = require("../lib/utils")

;(function () {
    if (utils.isPublicToken(context)) {
        var emailFrom = context.data.email
        var emailFromName =
            (context.data.firstname || "") +
            (context.data.firstname && context.data.lastname && " ") +
            (context.data.lastname || "")

        context.smtp.sendMail({
            to: config.operatorEmail,
            from: emailFrom,
            fromName: emailFromName,
            subject: utils.tpl(
                context,
                "templates/operator_contact_form_subject.de.txt"
            ),
            html: utils.tpl(
                context,
                "templates/operator_contact_form_body.de.html"
            ),
            // attach: ["attachments/AGB.pdf"],
        })
    }

    /** @type {import('tibi-types').HookResponse} */
    // @ts-ignore
    var response = null
    return response
})()
