<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Customer Attributes Base for Magento 2
 */-->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="email_order_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="email_order_comment_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="email_invoice_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="email_invoice_comment_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="email_shipment_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="email_shipment_comment_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="email_creditmemo_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="email_creditmemo_comment_set_template_vars_before">
        <observer name="Amasty_Customerattributes:order-email-variable" instance="Amasty\CustomerAttributes\Observer\OrderSender"/>
    </event>
    <event name="sales_order_save_after">
        <observer name="Amasty_Customerattributes::AfterSaveOrder" instance="Amasty\CustomerAttributes\Observer\Sales\Order\AfterSaveOrder" />
    </event>

    <event name="sales_quote_address_collect_totals_before">
        <observer name="Amasty_Customerattributes::saveQuoteAddress" instance="Amasty\CustomerAttributes\Observer\SaveQuoteAddress" />
    </event>

    <!-- for save attributes to customer when place order with registration -->
    <event name="customer_register_success">
        <observer name="Amasty_Customerattributes::successRegisterCustomer" instance="Amasty\CustomerAttributes\Observer\Sales\Order\SuccessRegisterCustomer" />
    </event>
</config>
