File size: 1,522 Bytes
cf14c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php

declare(strict_types=1);

namespace Affiliate\Domain\Repositories;

use Affiliate\Domain\Entities\PayoutEntity;
use Affiliate\Domain\Exceptions\PayoutNotFoundException;
use Affiliate\Domain\ValueObjects\SortParameter;
use Affiliate\Domain\ValueObjects\Status;
use Iterator;
use Shared\Domain\Repositories\RepositoryInterface;
use Shared\Domain\ValueObjects\Id;
use Shared\Domain\ValueObjects\SortDirection;
use User\Domain\Entities\UserEntity;

interface PayoutRepositoryInterface extends RepositoryInterface
{
    /**
     * Find payout entity by id
     *
     * @param Id $id
     * @return PayoutEntity
     * @throws PayoutNotFoundException
     */
    public function ofId(Id $id): PayoutEntity;

    /**
     * @param Status $status
     * @return static
     */
    public function filterByStatus(Status $status): static;

    /**
     * @param UserEntity $user
     * @return static
     */
    public function filterByUser(UserEntity $user): static;

    /**
     * @param SortDirection $dir 
     * @param null|SortParameter $sortParameter
     * @return static 
     */
    public function sort(
        SortDirection $dir,
        ?SortParameter $sortParameter = null
    ): static;

    /**
     * @param PayoutEntity $cursor 
     * @return Iterator<PayoutEntity> 
     */
    public function startingAfter(PayoutEntity $cursor): Iterator;

    /**
     * @param PayoutEntity $cursor 
     * @return Iterator<PayoutEntity> 
     */
    public function endingBefore(PayoutEntity $cursor): Iterator;
}