<?php

defined('ABSPATH') || exit; // Prevent direct file access.

use SGC\eGiftCard\Hooks\Handler\FilterHooksHandler;

// Display custom gift card data in cart
add_filter('woocommerce_get_item_data', [FilterHooksHandler::class, 'show_custom_gift_card_cart_data'], 10, 2);

// Display custom gift card design thumbnail in cart
add_filter('woocommerce_cart_item_thumbnail', [FilterHooksHandler::class, 'custom_gift_card_cart_thumbnail'], 10, 3);

// Customize quantity display for gift cards
add_filter('woocommerce_cart_item_quantity', [FilterHooksHandler::class, 'custom_gift_card_quantity_display'], 10, 3);

// Update cart item permalink for gift cards
add_filter('woocommerce_cart_item_permalink', [FilterHooksHandler::class, 'update_cart_item_permalink'], 10, 2);

// Remove gift card meta from order view
add_filter('woocommerce_order_item_get_formatted_meta_data', [FilterHooksHandler::class, 'sgc_smart_remove_gift_card_meta_from_order_view'], 10, 2);

// Hide gift card product from shop and catalog
add_filter('woocommerce_product_is_visible', [FilterHooksHandler::class, 'hide_gift_card_product'], 10, 2);

// Remove gift card meta from order view
add_filter('woocommerce_order_item_get_formatted_meta_data', [FilterHooksHandler::class, 'sgc_smart_remove_gift_card_meta_from_order_view'], 10, 2);

// Hide gift card product from shop and catalog
add_filter('woocommerce_product_is_visible', [FilterHooksHandler::class, 'hide_gift_card_product'], 10, 2);

// Exclude gift card product from product loops
add_filter('woocommerce_product_query', [FilterHooksHandler::class, 'exclude_gift_card_from_shop']);

// Exclude gift card from product widgets
add_filter('woocommerce_products_widget_query_args', [FilterHooksHandler::class, 'exclude_gift_card_from_widget']);

// Exclude gift card from related products
add_filter('woocommerce_related_products', [FilterHooksHandler::class, 'exclude_gift_card_from_related'], 10, 3);

// Exclude gift card from search results
add_filter('pre_get_posts', [FilterHooksHandler::class, 'exclude_gift_card_from_search']);

// Customize cart item name for gift cards
add_filter('woocommerce_cart_item_name', [FilterHooksHandler::class, 'custom_gift_card_cart_item_name'], 10, 3);

// Block adding gift card product to cart with other products if setting is disabled
add_filter('woocommerce_add_to_cart_validation', [FilterHooksHandler::class, 'block_mixed_cart_giftcard'], 10, 3);

// Disable coupons when gift cards are in the cart
add_filter('woocommerce_coupon_is_valid', [FilterHooksHandler::class, 'disable_coupons_with_gift_cards'], 10, 2);