<?php

declare(strict_types=1);

namespace App\Modules\Payments\Controllers;

use App\Modules\Payments\Application\PaymentService;

class PaymentsController
{
    public function __construct(private readonly PaymentService $paymentService)
    {
    }

    /**
     * @return array<string, mixed>
     */
    public function index(string $tenantId, string $memberId = 'tenant-member-demo'): array
    {
        $overview = $this->paymentService->paymentOverview($tenantId, $memberId);

        return [
            'view' => 'payments.index',
            'data' => [
                'title' => 'Einzahlungen und Zahlungsarten',
                'payments' => $overview['payments'] ?? [],
                'paymentOverview' => $overview,
            ],
        ];
    }
}
