<?php

declare(strict_types=1);

namespace ApiModel\Route;

use ApiModel\Action\ReportAction;
use ApiModel\Shared\Support\HttpRunner;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Routing\RouteCollectorProxy;

final class ReportRoutes
{
    public static function register(RouteCollectorProxy $g, ReportAction $action): void
    {
        $g->get('/reports/trial-balance', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->trialBalance($request)));
        $g->get('/reports/balance-sheet', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->balanceSheet($request)));
        $g->get('/reports/profit-and-loss', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->profitAndLoss($request)));
        $g->get('/reports/ar-aging', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->arAging($request)));
        $g->get('/reports/ap-aging', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->apAging($request)));
        $g->get('/reports/sales-book', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->salesBook($request)));
        $g->get('/reports/purchases-book', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->purchasesBook($request)));
        
        $g->get('/reports/journal-book', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->journalBook($request)));
        $g->get('/reports/general-ledger', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->generalLedger($request)));
        $g->get('/reports/tax-summary', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->taxSummary($request)));
    }
}
