<?php

/**
 * Copyright © Resurs Bank AB. All rights reserved.
 * See LICENSE for license details.
 */

declare(strict_types=1);

/** @var CostList $this */

use Resursbank\Ecom\Lib\Locale\Translator;
use Resursbank\Ecom\Lib\Model\PriceSignage\Cost;
use Resursbank\Ecom\Lib\Utilities\Price;
use Resursbank\Ecom\Module\PriceSignage\Widget\CostList;

?>

<div class="rb-ps-cl expanded" data-payment-method="<?= $this->method->id ?>">
    <?php /** @var Cost $cost */ ?>
    <div class="rb-ps-cl-expander">
        <div class="rb-ps-cl-expander-icon">
            &raquo;
        </div>
    </div>
    <div class="rb-ps-cl-content">
        <?php foreach ($this->priceSignage->costList as $cost): ?>
            <div class="rb-ps-cl-section">
                <div class="rb-ps-cl-row rb-ps-cl-title">
                    <span><?= $this->getDuration(cost: $cost) ?></span>
                    <span><?= Price::format(value: $cost->monthlyCost) ?> /
                        <?= Translator::translate('per-month-cost') ?>
                    </span>
                </div>
                <div class="rb-ps-cl-row-wrapper">
                    <div class="rb-ps-cl-row rb-ps-cl-info">
                        <span><?= $this->getSetupFee(cost: $cost) ?></span>
                    </div>
                    <div class="rb-ps-cl-row rb-ps-cl-info">
                        <span><?= $this->getAdministrationFee(cost: $cost) ?></span>
                    </div>
                    <div class="rb-ps-cl-row rb-ps-cl-info">
                        <span>
                            <?= Translator::translate(phraseId: 'interest') ?>
                            <?= $cost->interest ?>%
                        </span>
                    </div>
                    <div class="rb-ps-cl-row rb-ps-cl-info">
                        <span>
                            <?= Translator::translate(phraseId: 'effective-interest') ?>
                            <?= $cost->effectiveInterest ?>%
                        </span>
                    </div>
                    <div class="rb-ps-cl-row rb-ps-cl-info">
                        <span class="rb-ps-cl-bold">
                            <?= Translator::translate(phraseId: 'total') ?>
                            <?= Price::format(value: $cost->totalCost) ?>
                        </span>
                    </div>
                </div>
            </div>
        <?php endforeach; ?>
    </div>
</div>
