File size: 4,656 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php

declare(strict_types=1);

namespace Voice\Domain;

use Ai\Domain\ValueObjects\Model;
use Shared\Domain\Repositories\RepositoryInterface;
use Shared\Domain\ValueObjects\Id;
use Shared\Domain\ValueObjects\SortDirection;
use Traversable;
use Voice\Domain\Entities\VoiceEntity;
use Voice\Domain\Exceptions\VoiceNotFoundException;
use Voice\Domain\ValueObjects\Accent;
use Voice\Domain\ValueObjects\Age;
use Voice\Domain\ValueObjects\Gender;
use Voice\Domain\ValueObjects\LanguageCode;
use Voice\Domain\ValueObjects\Provider;
use Voice\Domain\ValueObjects\SortParameter;
use Voice\Domain\ValueObjects\Status;
use Voice\Domain\ValueObjects\Tone;
use Voice\Domain\ValueObjects\UseCase;

interface VoiceRepositoyInterface extends RepositoryInterface
{
    /**
     * Adds a new entity to the repository.
     * 
     * @param VoiceEntity $voice The entity to add.
     * @return static Returns the repository instance.
     */
    public function add(VoiceEntity $voice): static;

    /**
     * Removes an entity from the repository.
     * 
     * @param VoiceEntity $voice The entity to remove.
     * @return static Returns the repository instance.
     */
    public function remove(VoiceEntity $voice): static;

    /**
     * Retrieves an entity by its ID.
     * 
     * @param Id $id The ID of the entity.
     * @return VoiceEntity Returns the entity.
     * @throws VoiceNotFoundException If the entity is not found.
     */
    public function ofId(Id $id): VoiceEntity;

    /**
     * Filters entities by their status.
     * 
     * @param Status $status The status to filter by.
     * @return static Returns the repository instance.
     */
    public function filterByStatus(Status $status): static;

    /**
     * Filters entities by their provider.
     * 
     * @param Provider $provider
     * @return static
     */
    public function filterByProvider(Provider $provider): static;

    /**
     * Filters entities by their tone.
     * 
     * @param Tone $tone The tone to filter by.
     * @return static Returns the repository instance.
     */
    public function filterByTone(Tone $tone): static;

    /**
     * Filters entities by their use case.
     * 
     * @param UseCase $useCase The use case to filter by.
     * @return static Returns the repository instance.
     */
    public function filterByUseCase(UseCase $useCase): static;

    /**
     * Filters entities by gender.
     * 
     * @param Gender $gender The gender to filter by.
     * @return static Returns the repository instance.
     */
    public function filterByGender(Gender $gender): static;

    /**
     * Filters entities by accent.
     * 
     * @param Accent $accent
     * @return static
     */
    public function filterByAccent(Accent $accent): static;

    /**
     * Filters entities by age.
     * 
     * @param Age $age The age to filter by.
     * @return static Returns the repository instance.
     */
    public function filterByAge(Age $age): static;

    /**
     * Sets the maximum number of results to return.
     * 
     * @param int $max The maximum number of results.
     * @return static Returns the repository instance.
     */
    public function filterByLanguage(string|LanguageCode $language): static;

    /**
     * Filters entities by model.
     * 
     * @param Model ...$models The models to filter by.
     * @return static Returns the repository instance.
     */
    public function filterByModel(Model ...$models): static;

    /**
     * Searches for entities in the repository.
     * 
     * @param string $query The search query.
     * @return static Returns the repository instance.
     */
    public function search(string $query): static;

    /**
     * Sorts the entities in the repository.
     * 
     * @param SortDirection $dir The sort direction.
     * @param null|SortParameter $param The sort parameter (optional).
     * @return static Returns the repository instance.
     */
    public function sort(
        SortDirection $dir,
        ?SortParameter $param = null
    ): static;

    /**
     * Retrieves entities starting after a given cursor.
     *
     * @param VoiceEntity $cursor The cursor entity.
     * @return Traversable<int,VoiceEntity> Returns a traversable 
     * collection of entities.
     */
    public function startingAfter(VoiceEntity $cursor): Traversable;

    /**
     * Retrieves entities ending before a given cursor.
     *
     * @param VoiceEntity $cursor The cursor entity.
     * @return Traversable<int,VoiceEntity> Returns a traversable 
     * collection of entities.
     */
    public function endingBefore(VoiceEntity $cursor): Traversable;
}