mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 18:54:58 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			189 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			189 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * BudgetRepositoryInterface.php
 | |
|  * Copyright (C) 2016 thegrumpydictator@gmail.com
 | |
|  *
 | |
|  * This software may be modified and distributed under the terms of the
 | |
|  * Creative Commons Attribution-ShareAlike 4.0 International License.
 | |
|  *
 | |
|  * See the LICENSE file for details.
 | |
|  */
 | |
| 
 | |
| declare(strict_types = 1);
 | |
| 
 | |
| namespace FireflyIII\Repositories\Budget;
 | |
| 
 | |
| use Carbon\Carbon;
 | |
| use FireflyIII\Models\Budget;
 | |
| use FireflyIII\Models\BudgetLimit;
 | |
| use FireflyIII\Models\TransactionCurrency;
 | |
| use Illuminate\Support\Collection;
 | |
| 
 | |
| /**
 | |
|  * Interface BudgetRepositoryInterface
 | |
|  *
 | |
|  * @package FireflyIII\Repositories\Budget
 | |
|  */
 | |
| interface BudgetRepositoryInterface
 | |
| {
 | |
| 
 | |
|     /**
 | |
|      * @return bool
 | |
|      */
 | |
|     public function cleanupBudgets(): bool;
 | |
| 
 | |
|     /**
 | |
|      * @param Budget $budget
 | |
|      *
 | |
|      * @return bool
 | |
|      */
 | |
|     public function destroy(Budget $budget): bool;
 | |
| 
 | |
|     /**
 | |
|      * Filters entries from the result set generated by getBudgetPeriodReport
 | |
|      *
 | |
|      * @param Collection $set
 | |
|      * @param int        $budgetId
 | |
|      * @param array      $periods
 | |
|      *
 | |
|      * @return array
 | |
|      */
 | |
|     public function filterAmounts(Collection $set, int $budgetId, array $periods): array;
 | |
| 
 | |
|     /**
 | |
|      * Find a budget.
 | |
|      *
 | |
|      * @param int $budgetId
 | |
|      *
 | |
|      * @return Budget
 | |
|      */
 | |
|     public function find(int $budgetId): Budget;
 | |
| 
 | |
|     /**
 | |
|      * Find a budget.
 | |
|      *
 | |
|      * @param string $name
 | |
|      *
 | |
|      * @return Budget
 | |
|      */
 | |
|     public function findByName(string $name): Budget;
 | |
| 
 | |
|     /**
 | |
|      * This method returns the oldest journal or transaction date known to this budget.
 | |
|      * Will cache result.
 | |
|      *
 | |
|      * @param Budget $budget
 | |
|      *
 | |
|      * @return Carbon
 | |
|      */
 | |
|     public function firstUseDate(Budget $budget): Carbon;
 | |
| 
 | |
|     /**
 | |
|      * @return Collection
 | |
|      */
 | |
|     public function getActiveBudgets(): Collection;
 | |
| 
 | |
|     /**
 | |
|      * @param Carbon $start
 | |
|      * @param Carbon $end
 | |
|      *
 | |
|      * @return Collection
 | |
|      */
 | |
|     public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end): Collection;
 | |
| 
 | |
|     /**
 | |
|      * @param TransactionCurrency $currency
 | |
|      * @param Carbon              $start
 | |
|      * @param Carbon              $end
 | |
|      *
 | |
|      * @return string
 | |
|      */
 | |
|     public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string;
 | |
| 
 | |
|     /**
 | |
|      *
 | |
|      * @param Collection $budgets
 | |
|      * @param Collection $accounts
 | |
|      * @param Carbon     $start
 | |
|      * @param Carbon     $end
 | |
|      *
 | |
|      * @return array
 | |
|      */
 | |
|     public function getBudgetPeriodReport(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array;
 | |
| 
 | |
|     /**
 | |
|      * @return Collection
 | |
|      */
 | |
|     public function getBudgets(): Collection;
 | |
| 
 | |
|     /**
 | |
|      * @return Collection
 | |
|      */
 | |
|     public function getInactiveBudgets(): Collection;
 | |
| 
 | |
|     /**
 | |
|      * @param Collection $accounts
 | |
|      * @param Carbon     $start
 | |
|      * @param Carbon     $end
 | |
|      *
 | |
|      * @return array
 | |
|      */
 | |
|     public function getNoBudgetPeriodReport(Collection $accounts, Carbon $start, Carbon $end): array;
 | |
| 
 | |
|     /**
 | |
|      * @param TransactionCurrency $currency
 | |
|      * @param Carbon              $start
 | |
|      * @param Carbon              $end
 | |
|      * @param string              $amount
 | |
|      *
 | |
|      * @return bool
 | |
|      */
 | |
|     public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): bool;
 | |
| 
 | |
|     /**
 | |
|      * @param Collection $budgets
 | |
|      * @param Collection $accounts
 | |
|      * @param Carbon     $start
 | |
|      * @param Carbon     $end
 | |
|      *
 | |
|      * @return string
 | |
|      */
 | |
|     public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): string;
 | |
| 
 | |
|     /**
 | |
|      * @param Collection $accounts
 | |
|      * @param Carbon     $start
 | |
|      * @param Carbon     $end
 | |
|      *
 | |
|      * @return string
 | |
|      */
 | |
|     public function spentInPeriodWithoutBudget(Collection $accounts, Carbon $start, Carbon $end): string;
 | |
| 
 | |
|     /**
 | |
|      * @param array $data
 | |
|      *
 | |
|      * @return Budget
 | |
|      */
 | |
|     public function store(array $data): Budget;
 | |
| 
 | |
|     /**
 | |
|      * @param Budget $budget
 | |
|      * @param array  $data
 | |
|      *
 | |
|      * @return Budget
 | |
|      */
 | |
|     public function update(Budget $budget, array $data): Budget;
 | |
| 
 | |
|     /**
 | |
|      * @param Budget $budget
 | |
|      * @param Carbon $start
 | |
|      * @param Carbon $end
 | |
|      * @param string $range
 | |
|      * @param int    $amount
 | |
|      *
 | |
|      * @return BudgetLimit
 | |
|      */
 | |
|     public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $range, int $amount): BudgetLimit;
 | |
| 
 | |
| }
 |