<?php
/**
 * Trait: Anet_Customer_Profile
 *
 * Provides utility methods for handling customer profile meta keys
 * based on payment type (credit card or eCheck).
 *
 * @package Authorize_Net_Payments_For_Woocommerce
 * @subpackage Authorize_Net_Payments_For_Woocommerce/includes
 */

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

trait Anet_Customer_Profile
{
    /**
     * Returns the appropriate meta key based on payment type.
     *
     * @param bool $is_echeck Whether the payment method is eCheck.
     * @return string Meta key for storing customer profile ID.
     */
    public function get_customer_profile_meta_key($is_echeck = false)
    {
        $login_id_credit = Anet_Setting_Helper::get_cc_settings()['login_id'];
        $login_id_echeck = Anet_Setting_Helper::get_echeck_settings()['login_id'];
        if ($login_id_credit === $login_id_echeck) {
            return '_anet_customer_profile_id';
        }
        $meta_key = $is_echeck ? '_anet_customer_profile_id_echeck' : '_anet_customer_profile_id_creditcard';
        return $meta_key;
    }
}
