| 
									
										
										
										
											2015-02-09 07:23:39 +01:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2022-12-29 19:42:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 12:41:23 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * JournalRepositoryInterface.php | 
					
						
							| 
									
										
										
										
											2020-02-16 14:00:57 +01:00
										 |  |  |  * Copyright (c) 2019 james@firefly-iii.org | 
					
						
							| 
									
										
										
										
											2016-05-20 12:41:23 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * This file is part of Firefly III (https://github.com/firefly-iii). | 
					
						
							| 
									
										
										
										
											2016-10-05 06:52:15 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as | 
					
						
							|  |  |  |  * published by the Free Software Foundation, either version 3 of the | 
					
						
							|  |  |  |  * License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * GNU Affero General Public License for more details. | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
					
						
							| 
									
										
										
										
											2016-05-20 12:41:23 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-03-24 15:01:53 +01:00
										 |  |  | declare(strict_types=1); | 
					
						
							| 
									
										
										
										
											2015-02-09 07:23:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace FireflyIII\Repositories\Journal; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-10 22:34:02 +01:00
										 |  |  | use Carbon\Carbon; | 
					
						
							| 
									
										
										
										
											2020-02-28 18:56:27 +01:00
										 |  |  | use FireflyIII\Exceptions\FireflyException; | 
					
						
							| 
									
										
										
										
											2019-12-20 21:01:27 +01:00
										 |  |  | use FireflyIII\Models\Account; | 
					
						
							| 
									
										
										
										
											2019-03-30 07:09:52 +01:00
										 |  |  | use FireflyIII\Models\TransactionGroup; | 
					
						
							| 
									
										
										
										
											2015-04-07 18:26:14 +02:00
										 |  |  | use FireflyIII\Models\TransactionJournal; | 
					
						
							| 
									
										
										
										
											2018-12-20 22:03:34 +01:00
										 |  |  | use FireflyIII\Models\TransactionJournalLink; | 
					
						
							| 
									
										
										
										
											2017-01-30 16:40:49 +01:00
										 |  |  | use FireflyIII\User; | 
					
						
							| 
									
										
										
										
											2023-02-19 08:43:28 +01:00
										 |  |  | use Illuminate\Contracts\Auth\Authenticatable; | 
					
						
							| 
									
										
										
										
											2017-01-20 19:50:22 +01:00
										 |  |  | use Illuminate\Support\Collection; | 
					
						
							| 
									
										
										
										
											2015-02-09 07:23:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |  * Interface JournalRepositoryInterface. | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | interface JournalRepositoryInterface | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-04 16:31:16 +02:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2019-03-30 07:09:52 +01:00
										 |  |  |      * Deletes a transaction group. | 
					
						
							| 
									
										
										
										
											2017-07-04 16:31:16 +02:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2019-03-30 07:09:52 +01:00
										 |  |  |     public function destroyGroup(TransactionGroup $transactionGroup): void; | 
					
						
							| 
									
										
										
										
											2017-07-04 16:31:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-30 06:14:07 +01:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2016-11-05 11:47:21 +01:00
										 |  |  |      * Deletes a journal. | 
					
						
							| 
									
										
										
										
											2016-10-30 06:14:07 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2019-03-30 07:09:52 +01:00
										 |  |  |     public function destroyJournal(TransactionJournal $journal): void; | 
					
						
							| 
									
										
										
										
											2016-10-30 06:14:07 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-24 19:26:16 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Find a specific journal. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2021-06-30 06:17:38 +02:00
										 |  |  |     public function find(int $journalId): ?TransactionJournal; | 
					
						
							| 
									
										
										
										
											2018-04-24 19:26:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-18 10:26:12 +02:00
										 |  |  |     public function findByType(array $types): Collection; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-02 15:10:40 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Get users very first transaction journal. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function firstNull(): ?TransactionJournal; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-24 14:31:20 +01:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2021-03-12 06:20:01 +01:00
										 |  |  |      * Returns the destination account of the journal. | 
					
						
							| 
									
										
										
										
											2018-02-24 14:31:20 +01:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2021-03-12 06:20:01 +01:00
										 |  |  |      * @throws FireflyException | 
					
						
							| 
									
										
										
										
											2018-02-24 14:31:20 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2021-03-12 06:20:01 +01:00
										 |  |  |     public function getDestinationAccount(TransactionJournal $journal): Account; | 
					
						
							| 
									
										
										
										
											2018-02-24 14:31:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-25 19:09:05 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Return total amount of journal. Is always positive. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getJournalTotal(TransactionJournal $journal): string; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-12 06:20:01 +01:00
										 |  |  |     public function getLast(): ?TransactionJournal; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-12 21:49:28 +01:00
										 |  |  |     public function getLinkNoteText(TransactionJournalLink $link): string; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-02 05:44:51 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Return Carbon value of a meta field (or NULL). | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getMetaDateById(int $journalId, string $field): ?Carbon; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-12 06:20:01 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Returns the source account of the journal. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @throws FireflyException | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getSourceAccount(TransactionJournal $journal): Account; | 
					
						
							| 
									
										
										
										
											2018-02-24 14:31:20 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2022-10-30 11:43:17 +01:00
										 |  |  |      * TODO Maybe to account repository? Do this wen reconcile is API only. | 
					
						
							| 
									
										
										
										
											2018-02-28 21:32:59 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2019-06-23 05:53:01 +02:00
										 |  |  |     public function reconcileById(int $journalId): void; | 
					
						
							| 
									
										
										
										
											2018-02-28 21:32:59 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-12 06:20:01 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Search in journal descriptions. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function searchJournalDescriptions(string $search, int $limit): Collection; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-20 19:35:52 +01:00
										 |  |  |     public function setUser(null|Authenticatable|User $user): void; | 
					
						
							| 
									
										
										
										
											2016-05-15 12:08:41 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-28 15:03:33 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * TODO Maybe to account repository? Do this wen reconcile is API only. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function unreconcileById(int $journalId): void; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-23 16:21:28 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Update budget for a journal. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function updateBudget(TransactionJournal $journal, int $budgetId): TransactionJournal; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Update category for a journal. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function updateCategory(TransactionJournal $journal, string $category): TransactionJournal; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Update tag(s) for a journal. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function updateTags(TransactionJournal $journal, array $tags): TransactionJournal; | 
					
						
							| 
									
										
										
										
											2015-03-29 08:14:32 +02:00
										 |  |  | } |