File size: 1,633 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
63
64
65
66
67
68
69
70
<?php

declare(strict_types=1);

namespace Stat\Domain\Repositories;

use DateTimeInterface;
use Shared\Domain\Repositories\RepositoryInterface;
use Stat\Domain\Entities\AbstractStatEntity;
use Stat\Domain\ValueObjects\DatasetCategory;
use Stat\Domain\ValueObjects\StatType;
use Traversable;

interface StatRepositoryInterface extends RepositoryInterface
{
    /**
     * Add a stat entity to the repository.
     * 
     * @param AbstractStatEntity $stat
     * @return static
     */
    public function add(AbstractStatEntity $stat): static;

    /**
     * Filter the stat entity by type.
     * 
     * @param StatType $type
     * @return static
     */
    public function filterByType(StatType $type): static;

    /**
     * Filter the stat entity by year.
     * 
     * @param DateTimeInterface $date
     * @return static
     */
    public function filterByYear(DateTimeInterface $date): static;

    /**
     * Filter the stat entity by month.
     * 
     * @param DateTimeInterface $date
     * @return static
     */
    public function filterByMonth(DateTimeInterface $date): static;

    /**
     * Filter the stat entity by day.
     * 
     * @param DateTimeInterface $date
     * @return static
     */
    public function filterByDay(DateTimeInterface $date): static;

    /**
     * Get the total of the stat entity.
     * 
     * @return int
     */
    public function stat(): int;

    /**
     * Get the dataset for the stat entity.
     * 
     * @return Traversable<array{category:string,value:int}>
     */
    public function getDataset(DatasetCategory $type = DatasetCategory::DATE): Traversable;
}