<?php
declare(strict_types=1);

namespace App\Modules\Reports\Models;

use App\Core\App;

class ReportDefinition
{
    public static function getAllActive(): array
    {
        $db = App::getInstance()->db();
        return $db->select("SELECT * FROM report_definitions WHERE is_active = 1 ORDER BY category, name_ar");
    }

    public static function findByCode(string $code): ?array
    {
        $db = App::getInstance()->db();
        return $db->selectOne("SELECT * FROM report_definitions WHERE report_code = ? AND is_active = 1", [$code]);
    }
}