<?php
/**
 * filtersAjax.php
 *
 * @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.
 */

if (! defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}

//
//  array(
//      'filter'        => '',
//      'callback'      => '',
//      'priority'      => '',
//      'accepted_args' => '',
//  )
//
return apply_filters('wfc-filters_ajax', array(
    'ajax' => array(
        'action' => array(
            /**
             * Action OAuth Params
             */
            array(
                'filter'   => array(
                    'wp_ajax_OAuthFlow',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\OAuthFlow();
                },
                'priority' => 10,
            ),

            /**
             * Action OAuth Exchange
             * - token or device code
             */
            array(
                'filter'   => array(
                    'wp_ajax_oAuthExchange',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\oAuthExchange();
                },
                'priority' => 10,
            ),

            /**
             * Action refresh OAuth Token
             */
            array(
                'filter'   => array(
                    'wp_ajax_refreshOAuthToken',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\refreshOAuthToken();
                },
                'priority' => 10,
            ),

            /**
             * settings Company ID
             */
            array(
                'filter'   => array(
                    'wp_ajax_settingsCompany',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\settingsCompany();
                },
                'priority' => 10,
            ),

            /**
             * settings Payment Account
             */
            array(
                'filter'   => array(
                    'wp_ajax_settingsPaymentAccount',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\settingsPaymentAccount();
                },
                'priority' => 10,
            ),

            /**
             * settings mapping Payment Account whit method
             */
            array(
                'filter'   => array(
                    'wp_ajax_settingsMappingPayment',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\settingsMappingPayment();
                },
                'priority' => 10,
            ),

            /**
             * settings mapping Gateway whit method
             */
            array(
                'filter'   => array(
                    'wp_ajax_settingsMappingGateway',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\settingsMappingGateway();
                },
                'priority' => 10,
            ),

            /**
             * Action Create Invoice
             */
            array(
                'filter'   => array(
                    'wp_ajax_createInvoice',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\createInvoice();
                },
                'priority' => 10,
            ),

            /**
             * Action Verify E Invoice
             */
            array(
                'filter'   => array(
                    'wp_ajax_verifyEInvoice',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\verifyEInvoice();
                },
                'priority' => 10,
            ),

            /**
             * Action Sync E Invoice
             */
            array(
                'filter'   => array(
                    'wp_ajax_syncEInvoice',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\syncEInvoice();
                },
                'priority' => 10,
            ),

            /**
             * Action Send E Invoice
             */
            array(
                'filter'   => array(
                    'wp_ajax_sendInvoice',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\sendInvoice();
                },
                'priority' => 10,
            ),

            /**
             * Action Delete Invoice
             */
            array(
                'filter'   => array(
                    'wp_ajax_deleteInvoice',
                ),
                'callback' => function () {
                    \WooPoPToFattureInCloud\Functions\deleteInvoice();
                },
                'priority' => 10,
            ),
        ),
        'filter' => array(),
    ),
));
