<?php
namespace App\Controllers;

use App\Core\Auth;
use App\Core\Controller;
use App\Core\Permission;
use App\Models\ReductionParameter;

final class BillingReductionController extends Controller
{
    public function index(): void
    {
        Auth::requireLogin();
        Permission::require('facturation.reductions.apply');

        $this->view('billing/reductions',[
            'pageTitle'=>'Réductions en facturation',
            'rules'=>array_values(
                array_filter(
                    ReductionParameter::all(),
                    static fn(array $rule): bool =>
                        (int)$rule['actif'] === 1
                )
            ),
        ]);
    }
}
