/**
 * Conditionally Render Prices
 *
 * @param key
 * @param item
 * @returns {string}
 */
export function setProductPrice(key, item) {
    if (key === 'product') {

        if (item.price) {

            if (item.price.minimal_price && item.price.maximal_price) {
                return `
                    <div class="athena-price-container two-prices">
                        <div class="athena-minimal_maximal-price">
                            <span class="athena-price">${item.price.minimal_price_with_currency}</span>
                            <span class="athena-price">${item.price.maximal_price_with_currency}</span>
                        </div>
                    </div>
                `;
            }

            if (!item.price.loyalty_price) {

                if (item.price.special_price) {
                    return `
                       <div class="athena-price-container two-prices">
                            <span class="athena-price athena-price-when-sale">
                                ${item.price.regular_price_with_currency ? item.price.regular_price_with_currency : ''}
                            </span>
                            <span class="athena-price athena-sale-price">${item.price.special_price_with_currency}</span>
                            
                             <!-- Best Month Price -->
                            ${item.price.best_month_price ? `<span class="athena-price athena-sale-best-month">${item.price.best_month_price_with_currency}</span>` : ''}
                        </div>
                    `;
                } else {
                    return `
                            <div class="athena-price-container one-price">
                                <span class="athena-price">
                                    ${item.price.regular_price_with_currency ? item.price.regular_price_with_currency : ''}
                                </span>
                                        
                            <!-- Best Month Price -->
                            ${item.price.best_month_price ? `<span class="athena-price athena-sale-best-month">${item.price.best_month_price_with_currency}</span>` : ''}
                            </div>
                        `;
                }

            } else {

                if (item.price.special_price) {
                    return `
                       <div class="athena-price-container two-prices loyalty-price-container loyalty-price-container-special-price">
                            <span class="athena-price athena-price-when-sale">
                                ${item.price.regular_price_with_currency ? item.price.regular_price_with_currency : ''}
                            </span>
                            
                            <span class="athena-price athena-sale-price">${item.price.special_price_with_currency}</span>
                            
                            <span class="athena-price athena-sale-price">
                                <span>
                                    ${item.price.loyalty_price_with_currency}
                                </span>
                            </span>
                
                             <!-- Best Month Price -->
                            ${item.price.best_month_price ? `<span class="athena-price athena-sale-best-month">${item.price.best_month_price_with_currency}</span>` : ''}
                        </div>
                    `;
                } else {
                    return `
                        <div class="athena-price-container two-prices loyalty-price-container loyalty-price-container-no-special-price">
                            <span class="athena-price athena-price-when-sale">
                                ${item.price.regular_price_with_currency ? item.price.regular_price_with_currency : ''}
                            </span>
                            
                            <span class="athena-price athena-sale-price">
                                <span>
                                    ${item.price.loyalty_price_with_currency}
                                </span>
                            </span>
                
                            <!-- Best Month Price -->
                            ${item.price.best_month_price ? `<span class="athena-price athena-sale-best-month">${item.price.best_month_price_with_currency}</span>` : ''}
                        </div>
                    `;
                }
            }
        }
    }
}