// app/modules/loyalty/static/admin/js/loyalty-merchant-card-detail.js
// Admin wrapper for shared loyalty card detail view (on-behalf view).

const adminMerchantCardDetailLog = window.LogConfig.loggers.adminMerchantCardDetail || window.LogConfig.createLogger('adminMerchantCardDetail');

function adminMerchantCardDetail() {
    // Extract merchant_id and card_id from URL: /admin/loyalty/merchants/{merchant_id}/cards/{card_id}
    const pathParts = window.location.pathname.split('/');
    const merchantsIndex = pathParts.indexOf('merchants');
    const merchantId = merchantsIndex !== -1 ? pathParts[merchantsIndex + 1] : null;

    return loyaltyCardDetailView({
        apiPrefix: '/admin/loyalty/merchants/' + merchantId,
        backUrl: '/admin/loyalty/merchants/' + merchantId + '/cards',
        currentPage: 'loyalty-programs',
    });
}

if (!window.LogConfig.loggers.adminMerchantCardDetail) {
    window.LogConfig.loggers.adminMerchantCardDetail = window.LogConfig.createLogger('adminMerchantCardDetail');
}
adminMerchantCardDetailLog.info('Admin merchant card detail module loaded');
