<?php
/**
 * POPEmails.php
 *
 * @since
 * @package    WcElectronInvoice\WooCommerce\Emails
 * @author     alfiopiccione <alfio.piccione@gmail.com>

 * @license    http://opensource.org/licenses/gpl-2.0.php GPL v2
 *
 * Copyright (C) 2025 POP
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

namespace WcElectronInvoice\WooCommerce\Emails;

if (! defined('ABSPATH')) {
    exit;
}

/**
 * Class POPEmails
 *
 * @author alfiopiccione <alfio.piccione@gmail.com>
 */
final class WooPopEmails
{
    /**
     * Emails classes
     *
     * @param $emails
     *
     * @return array
     */
    public static function emailClasses($emails)
    {
        // @codingStandardsIgnoreLine
        if (! class_exists("\WcElectronInvoice\WooCommerce\Emails\InvoiceXmlCompletedOrder")) {
            require_once \WcElectronInvoice\Plugin::getPluginDirPath('/src/WooCommerce/Emails/InvoiceXmlCompletedOrder.php');
        }

        // @codingStandardsIgnoreLine
        if (! class_exists("\WcElectronInvoice\WooCommerce\Emails\InvoicePdfCompletedOrder")) {
            require_once \WcElectronInvoice\Plugin::getPluginDirPath('/src/WooCommerce/Emails/InvoicePdfCompletedOrder.php');
        }

        // @codingStandardsIgnoreLine
        if (! class_exists("\WcElectronInvoice\WooCommerce\Emails\ReceiptPdfCompletedOrder")) {
            require_once \WcElectronInvoice\Plugin::getPluginDirPath('/src/WooCommerce/Emails/ReceiptPdfCompletedOrder.php');
        }

        // @codingStandardsIgnoreLine
        $emails['InvoiceXmlCompletedOrder'] = new \WcElectronInvoice\WooCommerce\Emails\InvoiceXmlCompletedOrder();
        // @codingStandardsIgnoreLine
        $emails['InvoicePdfCompletedOrder'] = new \WcElectronInvoice\WooCommerce\Emails\InvoicePdfCompletedOrder();
        // @codingStandardsIgnoreLine
        $emails['ReceiptPdfCompletedOrder'] = new \WcElectronInvoice\WooCommerce\Emails\ReceiptPdfCompletedOrder();

        return $emails;
    }

    /**
     * Emails actions
     *
     * @param $actions
     *
     * @return array
     */
    public static function emailActions($actions)
    {
        // Use custom action for send custom email notification
        return array_merge($actions, array(
            'wc_el_inv_email_send',
        ));
    }
}
