<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Services\PaymentReminderService;
use Illuminate\Http\Request;

class PaymentReminderController extends Controller
{

    /* not used at the moment */ 
    private $paymentReminderService;

    public function __construct(PaymentReminderService $paymentReminderService)
    {
        $this->paymentReminderService = $paymentReminderService;
    }

    /**
     * Zeige die Payment Reminders Übersicht
     */
    public function index()
    {
        $detailedData = $this->paymentReminderService->getDetailedPaymentsData();
        $summaryData = $this->paymentReminderService->getAllOpenPayments();
        
        // Statistiken für die Übersicht
        $totalPayments = collect($detailedData)->count();
        $totalAmount = collect($detailedData)->sum('amount');
        $clearingTypes = collect($detailedData)->groupBy('clearingtype')->map->count();
        
        return view('admin.payment.reminder.index', compact(
            'detailedData', 
            'summaryData', 
            'totalPayments', 
            'totalAmount', 
            'clearingTypes'
        ));
    }
} 