<?php

namespace AmadeusAgentur\AmadeusNext\Domain\Repository;

use TYPO3\CMS\Extbase\Persistence\Repository;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;

class AwardRepository extends Repository {
    public function findAwardsByAmount(int $amt): QueryResultInterface {
        $query = $this->createQuery();

        $query->matching(
            $query->equals('hidden', false)
        );

        $query->setOrderings([
            'importance' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
        ]);

        $query->setLimit($amt);

        return $query->execute();
    }
}