<?php

namespace App\Controllers\Reports;

use App\Controllers\BaseController;
use CodeIgniter\API\ResponseTrait;

// Modelos de vistas
use App\Models\Reports\ContractPaymentSummaryModel;
use App\Models\Reports\ContractPaymentDetailModel;
use App\Models\Reports\PaymentAbonoDetailModel;
use App\Models\Reports\ContractAccountStatementModel;
use App\Models\Reports\OverduePaymentsModel;

class ReportsController extends BaseController
{
    use ResponseTrait;

    public function index()
    {
        $summaryModel   = new ContractPaymentSummaryModel();
        $detailModel    = new ContractPaymentDetailModel();
        $abonoModel     = new PaymentAbonoDetailModel();
        $statementModel = new ContractAccountStatementModel();
        $overdueModel   = new OverduePaymentsModel();

        return $this->respond([
            'contract_payment_summary' => $summaryModel->findAll(),
            'contract_payment_detail'  => $detailModel->findAll(),
            'payment_abonos'           => $abonoModel->findAll(),
            'account_statements'       => $statementModel->findAll(),
            'overdue_payments'         => $overdueModel->findAll(),
        ]);
    }
}