export default function({
  discountPrice,
  parcelNumber,
  parcelPrice,
  priceColor,
  customPreview,
  discountType,
  custom,
  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: `${discountPrice} no boleto à vista ou até ${parcelNumber}x sem juros de ${parcelPrice}`,

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

    $valor = $special;
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_parcelado_promo = number_format($replace_valor/${parcelNumber} , 2,',','.');
    $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 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; 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) {
    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;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>');
    }
    }`,
    exibition: `$preco = number_format($product['price_pr'], 2,',','.');
    $preco_parcelado = number_format(($product['price_pr']/${parcelNumber}), 2,',','.');
    $preco_promo = $product['special'];
    $preco_discount = ${priceDiscountExibition};

    $valor = $product['special'];
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_parcelado_promo = number_format($replace_valor/${parcelNumber} , 2,',','.');
    $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 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: 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;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_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 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: 14;">R$ ' . $preco .
    '</span><span style="color: #737373; display:block;font-size: 16;font-weight: 400;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>'));
    }
    }`,
  };

  const modelCustom = {
    preview: customPreview,

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

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

    if ($preco_promo) {
    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; 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_parcelado = number_format(($product['price_pr']/${parcelNumber}), 2,',','.');
    $preco_promo = $product['special'];
    $preco_discount = ${priceDiscountExibition};

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

    if ($preco_promo) {
    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;">${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: `Em até ${parcelNumber}x sem juros de ${parcelPrice}`,

    product: `$preco = number_format($pr, 2,',','.');
    $preco_parcelado = number_format(($pr/${parcelNumber}), 2,',','.');
    $preco_promo = $special;

    $valor = $special;
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_parcelado_promo = number_format($replace_valor/${parcelNumber} , 2,',','.');

    if ($preco_promo) {
    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; 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: ${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>'));
    }`,
    exibition: `$preco = number_format($product['price_pr'], 2,',','.');
    $preco_parcelado = number_format(($product['price_pr']/${parcelNumber}), 2,',','.');
    $preco_promo = $product['special'];

    $valor = $product['special'];
    $replace_valor = (double) trim(str_replace(['R$', '.', ','], ['', '', '.'], $valor));
    $preco_parcelado_promo = number_format($replace_valor/${parcelNumber} , 2,',','.');

    if ($preco_promo) {
    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;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado_promo . '</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;">Em até ${parcelNumber}x sem juros de R$ ' . $preco_parcelado . '</span>'));
    }`,
  };

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