export default function ({
  discountPrice,
  parcelNumber,
  parcelPrice,
  priceColor,
  totalParcels,
  customPreview,
  discountType,
  parcel_with_discounts,
  parcel_with_no_fees,
  discount_parcels,
  custom,
  increaseValue,
  customPromotion,
  discountValue,
}) {
  const priceDiscountProduct =
    discountType == 2
      ? `number_format($pr - ($pr * ${discountValue})/100, 2,',','.')`
      : `number_format($pr - ${discountValue}, 2,',','.')`,
    priceDiscountExibition =
      discountType == 2
        ? `number_format($product['price_pr'] - ($product['price_pr'] * ${discountValue})/100, 2,',','.')`
        : `number_format($product['price_pr'] - ${discountValue}, 2,',','.')`,
    pricePromoDiscount =
      discountType == 2
        ? `number_format($replace_valor - ($replace_valor * ${discountValue})/100, 2,',','.')`
        : `number_format($replace_valor - ${discountValue}, 2,',','.')`;

  const modelComplete = {
    preview: parcelNumber > 0 ?
    (parcel_with_discounts > 0 && parcel_with_no_fees == 0 ?
      `${discountPrice} no boleto à vista ou até ${parcelNumber}x com desconto de ${parcelPrice}` :
      `${discountPrice} no boleto à vista ou até ${parcelNumber}x sem juros de ${parcelPrice}`) :
    `${discountPrice} no boleto à vista ou até ${totalParcels}x de ${parcelPrice}`,

    product: `$preco = number_format($pr, 2,',','.');
    $total_parcels = ${parcelNumber};
    $parcel_with_no_fees = ${parcel_with_no_fees};
    $parcel_with_discounts = ${parcel_with_discounts};
    $number_parcels = ${parcelNumber > 0} ? '${parcelNumber}' : ${totalParcels};
    $preco_promo = $special;
    $increase_value = '${increaseValue}';
    $discount_parcels = str_replace(',', '.', '${discount_parcels}');;
    $preco_discount = ${priceDiscountProduct};

    $valor = $special;
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_promo_discount = ${pricePromoDiscount};


    if($total_parcels > 0){
      $preco_parcelado = number_format(($pr/$total_parcels), 2,',','.');
      $preco_parcelado_promo = number_format($replace_valor/$total_parcels , 2,',','.');
    }

    if($parcel_with_discounts > 0){
      $parcel_price_discount = ($pr - ($pr * ($discount_parcels / 100))) / $parcel_with_discounts;
      $parcel_price_discount = number_format($parcel_price_discount, 2,',','.');
    }

    $price_with_fees = ftr_geral::juroComposto($pr, $number_parcels, $increase_value);

    $price_promo = str_replace(',', '.', $preco_promo);
    $price_discount_valid = str_replace(',', '.', $preco_discount);
    $price_promo_discount_valid = str_replace(',', '.', $preco_promo_discount);

    if($special){
      $price_with_fees = ftr_geral::juroComposto($replace_valor, $number_parcels, $increase_value);
    }else{
      $price_with_fees = ftr_geral::juroComposto($pr, $number_parcels, $increase_value);
    }

    $price_with_fees = $price_with_fees/$number_parcels;
    $price_with_fees = number_format($price_with_fees, 2,',','.');

    if ($preco_promo) {
    if ($price_promo > $price_promo_discount_valid) {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode('
          <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
          ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
          ' no boleto à vista ou até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>');
        }else{
          echo html_entity_decode('
          <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
          ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
          ' no boleto à vista ou até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_promo . '</span>');
        }
      }else{
        echo html_entity_decode('
        <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
        '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
        ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
        ' no boleto à vista ou até ${totalParcels}x de R$ ' . $price_with_fees . '</span>');
      }
    } else {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode('
          <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
          ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>');
        }else{
          echo html_entity_decode('
          <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
          ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_promo . '</span>');
        }
      }else{
        echo html_entity_decode('
        <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
        '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
        ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${totalParcels}x de R$ ' . $price_with_fees . '</span>');
      }
    }
    } else {
    if ($price > $price_discount_valid) {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode('
          <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_discount .
          ' no boleto à vista ou até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>');
        }else{
          echo html_entity_decode('
          <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_discount .
          ' no boleto à vista ou até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>');
        }
      }else{
        echo html_entity_decode('
        <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
        '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_discount .
        ' no boleto à vista ou até ${totalParcels}x de R$ ' . $price_with_fees . '</span>');
      }
    } else {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode('
          <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>');
        }else{
          echo html_entity_decode('
          <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>');
        }
      }else{
        echo html_entity_decode('
        <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
        '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">Em até ${totalParcels}x de R$ ' . $price_with_fees . '</span>');
      }
    }
    }`,
    exibition: `$preco = number_format($product['price_pr'], 2,',','.');
    $total_parcels = ${parcelNumber};
    $parcel_with_no_fees = ${parcel_with_no_fees};
    $parcel_with_discounts = ${parcel_with_discounts};

    $number_parcels = ${parcelNumber > 0} ? '${parcelNumber}' : ${totalParcels};
    $preco_promo = $product['special'];
    $preco_discount = ${priceDiscountExibition};
    $increase_value = '${increaseValue}';
    $discount_parcels = str_replace(',', '.', '${discount_parcels}');

    $valor = $product['special'];
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_promo_discount = ${pricePromoDiscount};

    $price = str_replace(',', '.', $preco);
    $price_promo = str_replace(',', '.', $preco_promo);
    $price_discount_valid = str_replace(',', '.', $preco_discount);
    $price_promo_discount_valid = str_replace(',', '.', $preco_promo_discount);

    if($product['special']){
      $price_with_fees = ftr_geral::juroComposto($replace_valor, $number_parcels, $increase_value);
    }else{
      $price_with_fees = ftr_geral::juroComposto($product['price_pr'], $number_parcels, $increase_value);
    }

    $price_with_fees = $price_with_fees/$number_parcels;
    $price_with_fees = number_format($price_with_fees, 2,',','.');

    if($total_parcels > 0){
      $preco_parcelado = number_format(($product['price_pr']/$total_parcels), 2,',','.');
      $preco_parcelado_promo = number_format(($replace_valor/$total_parcels) , 2,',','.');
    }

    if($parcel_with_discounts > 0){
      $parcel_price_discount = ($product['price_pr'] - ($product['price_pr'] * ($discount_parcels / 100))) / $parcel_with_discounts;
      $parcel_price_discount = number_format($parcel_price_discount, 2,',','.');
    }

    if ($preco_promo) {
    if ($price_promo > $price_promo_discount_valid) {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14px;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-size: 16px;font-weight: 700;">' . $preco_promo .
          ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
          ' no boleto à vista ou até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>'));
        }else{
          echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14px;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-size: 16px;font-weight: 700;">' . $preco_promo .
          ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
          ' no boleto à vista ou até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_promo . '</span>'));
        }
      }else{
        echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14px;"><s>R$ ' . $preco .
        '</s></span><span style="color: ${priceColor}; display:block;font-size: 16px;font-weight: 700;">' . $preco_promo .
        ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
        ' no boleto à vista ou até ${totalParcels}x de R$ ' . $price_with_fees . '</span>'));
      }
    } else {
    echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14px;"><s>R$ ' . $preco .
    '</s></span><span style="color: ${priceColor}; display:block;font-size: 16px;font-weight: 700;">' . $preco_promo .
    ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_promo . '</span>'));
    }
    } else {
    if ($price > $price_discount_valid) {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">R$ ' . $preco_discount .
          ' no boleto à vista ou até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>'));
        }else{
          echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">R$ ' . $preco_discount .
          ' no boleto à vista ou até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>'));
        }
      }else{
        echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
        '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">R$ ' . $preco_discount .
        ' no boleto à vista ou até ${totalParcels}x de R$ ' . $price_with_fees . '</span>'));
      }
    } else {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">Em até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>'));
        }else{
          echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>'));
        }
      }else{
        echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
        '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">Em até ${totalParcels}x de R$ ' . $price_with_fees . '</span>'));
      }
    }
    }`,
  };

  const modelCustom = {
    preview: customPreview,

    product: `$preco = number_format($pr, 2,',','.');
    $preco_promo = $special;
    $preco_discount = 'R$ ' . ${priceDiscountProduct} . '';
    $valor = $special;
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_parcelado_promo = number_format($replace_valor/${totalParcels} , 2,',','.');
    $preco_promo_discount = 'R$ ' . ${pricePromoDiscount} . '';

    $increase_value = '${increaseValue}';
    $discount_value = str_replace(',', '.', '${discount_parcels}');;
    
    $quantity_parcels =  ${totalParcels}-${parcel_with_no_fees}-${parcel_with_discounts};

    if($increase_value) {
      $juros = !empty($increase_value) ? preg_replace('/[^0-9\\s]+/', '.', $increase_value) : 0;
      $juros = (float) $juros;
      $preco_value = (float) $preco;
      $increase = $preco_value * pow((1 + ($juros / 100)), $quantity_parcels);

      if(${parcel_with_discounts}) {
          $desconto = !empty($discount_value) ? preg_replace('/[^0-9\\s]+/', '.', $discount_value) : 0;
          $desconto = (float) $desconto;
          $discount = $increase - ($increase * ($desconto / 100));
          $preco_parcelado = 'R$ ' . number_format(($discount / ${totalParcels}), 2, ',', '.') . '';
      }else {
          $preco_parcelado = 'R$ ' . number_format(($increase / ${totalParcels}), 2, ',', '.') . '';
      };
    }else {
      $preco_parcelado = 'R$ ' . number_format(($product['price_pr'] / ${totalParcels}), 2, ',', '.') . '';
    };

    if ($preco_promo) {
    echo html_entity_decode(nl2br('
    <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><span>R$ ' . $preco .
    '</span></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
    ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">${customPromotion}</span>'));
    } else {
    echo html_entity_decode(nl2br('
    <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
    '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">${custom}</span>'));
    }`,

    exibition: `$preco = number_format($product['price_pr'], 2,',','.');
    $preco_promo = $product['special'];
    $preco_discount = 'R$ ' . ${priceDiscountExibition} . '';
    $valor = $product['special'];
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_parcelado_promo = number_format($replace_valor/${totalParcels} , 2,',','.');
    $preco_promo_discount = 'R$ ' . ${pricePromoDiscount} . '';

    $increase_value = '${increaseValue}';
    $discount_value = str_replace(',', '.', '${discount_parcels}');;
    $quantity_parcels =  ${totalParcels}-${parcel_with_no_fees}-${parcel_with_discounts};

    if ($increase_value) {
       $juros = !empty($increase_value) ? preg_replace('/[^0-9\\s]+/', '.', $increase_value) : 0;
       $juros = (float) $juros;
       $preco_value = (float) $preco;
       $increase = $preco_value * pow((1 + ($juros / 100)), $quantity_parcels);

       if (${parcel_with_discounts}) {
           $desconto = !empty($discount_value) ? preg_replace('/[^0-9\\s]+/', '.', $discount_value) : 0;
           $desconto = (float) $desconto;
           $discount = $increase - ($increase * ($desconto / 100));
           $preco_parcelado = 'R$ ' . number_format(($discount / ${totalParcels}), 2, ',', '.') . '';
       }else {
           $preco_parcelado = 'R$ ' . number_format(($increase / ${totalParcels}), 2, ',', '.') . '';
       };
    }else{
      $preco_parcelado = 'R$ ' . number_format(($product['price_pr'] / ${totalParcels}), 2, ',', '.') . '';
    };

    if ($preco_promo) {
    echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14;"><span>R$ ' . $preco .
    '</span></span><span style="color: ${priceColor}; display:block;font-size: 16;font-weight: 700;">' . $preco_promo .
    ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">${customPromotion}</span>'));
    } else {
    echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14;">R$ ' . $preco .
    '</span><span style="color: #737373; display:block;font-size: 16;font-weight: 400;">${custom}</span>'));
    }`,
  };

  const modelBillet = {
    preview: `${discountPrice} no boleto à vista`,

    product: `$preco = number_format($pr, 2,',','.');
    $preco_promo = $special;
    $preco_discount = ${priceDiscountProduct};

    $valor = $special;
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_promo_discount = ${pricePromoDiscount};

    $price = str_replace(',', '.', $preco);
    $price_promo = str_replace(',', '.', $preco_promo);
    $price_discount_valid = str_replace(',', '.', $preco_discount);
    $price_promo_discount_valid = str_replace(',', '.', $preco_promo_discount);

    if ($preco_promo) {
    if ($price_promo > $price_promo_discount_valid) {
    echo html_entity_decode('
    <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
    '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
    ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
    ' no boleto à vista</span>');
    } else {
    echo html_entity_decode('
    <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
    '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo . ' </span>');
    }
    } else {
    if ($price > $price_discount_valid) {
    echo html_entity_decode('
    <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
    '</span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_discount . ' no boleto à vista</span>');
    } else {
    echo html_entity_decode('
    <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco . '</span>');
    }
    }`,
    exibition: `$preco = number_format($product['price_pr'], 2,',','.');
    $preco_promo = $product['special'];
    $preco_discount = ${priceDiscountExibition};

    $valor = $product['special'];
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_promo_discount = ${pricePromoDiscount};

    $price = str_replace(',', '.', $preco);
    $price_promo = str_replace(',', '.', $preco_promo);
    $price_discount_valid = str_replace(',', '.', $preco_discount);
    $price_promo_discount_valid = str_replace(',', '.', $preco_promo_discount);

    if ($preco_promo) {
    if ($price_promo > $price_promo_discount_valid) {
    echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14;"><s>R$ ' . $preco .
    '</s></span><span style="color: ${priceColor}; display:block;font-size: 16;font-weight: 700;">' . $preco_promo .
    ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">R$ ' . $preco_promo_discount .
    ' no boleto à vista</span>'));
    } else {
    echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14;"><s>R$ ' . $preco .
    '</s></span><span style="color: ${priceColor}; display:block;font-size: 16;font-weight: 700;">' . $preco_promo . '</span>'));
    }
    } else {
    if ($price > $price_discount_valid) {
    echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14;">R$ ' . $preco .
    '</span><span style="color: #737373; display:block;font-size: 16;font-weight: 400;">R$ ' . $preco_discount . ' no boleto à vista</span>'));
    } else {
    echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14;">R$ ' . $preco . '</span>'));
    }
    }`,
  };

  const modelParcel = {
    preview: parcelNumber > 0 ?
    (parcel_with_discounts > 0 && parcel_with_no_fees == 0 ?
      `Em até ${parcelNumber}x com desconto de ${parcelPrice}` :
      `Em até ${parcelNumber}x sem juros de ${parcelPrice}`) :
    `Em até ${totalParcels}x de ${parcelPrice}`,

    product: `$preco = number_format($pr, 2,',','.');
    $total_parcels = ${parcelNumber};
    $parcel_with_no_fees = ${parcel_with_no_fees};
    $parcel_with_discounts = ${parcel_with_discounts};
    $number_parcels = ${parcelNumber > 0} ? '${parcelNumber}' : ${totalParcels};
    $preco_promo = $special;
    $increase_value = '${increaseValue}';
    $discount_parcels = str_replace(',', '.', '${discount_parcels}');;

    $valor = $special;
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));

    if($parcel_with_discounts > 0){
      $parcel_price_discount = ($pr - ($pr * ($discount_parcels / 100))) / $parcel_with_discounts;
      $parcel_price_discount = number_format($parcel_price_discount, 2,',','.');
    }

    if($total_parcels > 0){
      $preco_parcelado = number_format(($pr/$total_parcels), 2,',','.');
      $preco_parcelado_promo = number_format($replace_valor/$total_parcels , 2,',','.');
    }

    if($special){
      $price_with_fees = ftr_geral::juroComposto($replace_valor, $number_parcels, $increase_value);
    }else{
      $price_with_fees = ftr_geral::juroComposto($pr, $number_parcels, $increase_value);
    }

    $price_with_fees = $price_with_fees/$number_parcels;
    $price_with_fees = number_format($price_with_fees, 2,',','.');

    if ($preco_promo) {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode(nl2br('
          <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
          ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>'));
        }else{
          echo html_entity_decode(nl2br('
          <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
          ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_promo . '</span>'));
        }
      }else{
        echo html_entity_decode(nl2br('
        <span style="color: #737373;display:block;font-size: 1rem;line-height: 1.25rem;"><s>R$ ' . $preco .
        '</s></span><span style="color: ${priceColor}; display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">' . $preco_promo .
        ' </span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${totalParcels}x de R$ ' . $price_with_fees . '</span>'));
      }
    } else {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode(nl2br('
          <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
          '</span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . ' </span>'));
        }else{
          echo html_entity_decode(nl2br('
          <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
          '</span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . ' </span>'));
        }
      }else{
        echo html_entity_decode(nl2br('
        <span style="color: ${priceColor};display:block;font-weight: 700;font-size: 2rem;line-height: 2.25rem;">R$ ' . $preco .
        '</span><span style="color: #737373; font-size: 1rem;line-height: 1.25rem;">Em até ${totalParcels}x de R$ ' . $price_with_fees . ' </span>'));
      }
    }`,
    exibition: `$preco = number_format($product['price_pr'], 2,',','.');
    $number_parcels = ${parcelNumber > 0} ? '${parcelNumber}' : ${totalParcels};
    $total_parcels = ${parcelNumber};
    $parcel_with_no_fees = ${parcel_with_no_fees};
    $parcel_with_discounts = ${parcel_with_discounts};
    $preco_promo = $product['special'];

    $valor = $product['special'];
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));

    $increase_value = '${increaseValue}';
    $discount_parcels = str_replace(',', '.', '${discount_parcels}');;

    if($total_parcels > 0){
      $preco_parcelado_promo = number_format($replace_valor/$total_parcels  , 2,',','.');
      $preco_parcelado = number_format(($product['price_pr']/$total_parcels ), 2,',','.');
    }

    if($parcel_with_discounts > 0){
      $parcel_price_discount = ($product['price_pr'] - ($product['price_pr'] * ($discount_parcels / 100))) / $parcel_with_discounts;
      $parcel_price_discount = number_format($parcel_price_discount, 2,',','.');
    }

    if($product['special']){
      $price_with_fees = ftr_geral::juroComposto($replace_valor, $number_parcels, $increase_value);
    }else{
      $price_with_fees = ftr_geral::juroComposto($product['price_pr'], $number_parcels, $increase_value);
    }

    $price_with_fees = $price_with_fees/$number_parcels;
    $price_with_fees = number_format($price_with_fees, 2,',','.');

    if ($preco_promo) {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: px;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-size: 16px;font-weight: 700;">' . $preco_promo .
          ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . ' </span>'));
        }else{
          echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14px;"><s>R$ ' . $preco .
          '</s></span><span style="color: ${priceColor}; display:block;font-size: 16px;font-weight: 700;">' . $preco_promo .
          ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_promo . ' </span>'));
        }
      }else{
        echo html_entity_decode(nl2br('<span style="color: #737373;display:block;font-size: 14px;"><s>R$ ' . $preco .
        '</s></span><span style="color: ${priceColor}; display:block;font-size: 16px;font-weight: 700;">' . $preco_promo .
        ' </span><span style="color: #737373; display:block;font-size: 1rem;line-height: 1.25rem;">Em até ${totalParcels}x de R$ ' . $price_with_fees . ' </span>'));
      }
    } else {
      if($total_parcels > 0){
        if($parcel_with_discounts > 0 && $parcel_with_no_fees == 0){
          echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">Em até ${parcelNumber}x com desconto de R$ ' . $parcel_price_discount . '</span>'));
        }else{
          echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
          '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>'));
        }
      }else{
        echo html_entity_decode(nl2br('<span style="color: ${priceColor}; display:block;font-size: 14px;">R$ ' . $preco .
        '</span><span style="color: #737373; display:block;font-size: 16px;font-weight: 400;">Em até ${totalParcels}x de R$ ' . $price_with_fees . '</span>'));
      }
    }`,
  };

  return {
    complete: modelComplete,
    custom: modelCustom,
    billet: modelBillet,
    parcel: modelParcel,
  };
}
