mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-16 11:42:06 -06:00
202 lines
4.7 KiB
PHP
202 lines
4.7 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 FireflyIII\User;
|
|
use Illuminate\Support\Collection;
|
|
|
|
/**
|
|
* Interface BudgetRepositoryInterface
|
|
*
|
|
* @package FireflyIII\Repositories\Budget
|
|
*/
|
|
interface BudgetRepositoryInterface
|
|
{
|
|
/**
|
|
* @param User $user
|
|
*/
|
|
public function setUser(User $user);
|
|
|
|
/**
|
|
* @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 getAllBudgetLimits(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 Budget $budget
|
|
* @param Carbon $start
|
|
* @param Carbon $end
|
|
*
|
|
* @return Collection
|
|
*/
|
|
public function getBudgetLimits(Budget $budget, Carbon $start, Carbon $end): Collection;
|
|
|
|
/**
|
|
*
|
|
* @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 spentInPeriodWoBudget(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 int $amount
|
|
*
|
|
* @return BudgetLimit
|
|
*/
|
|
public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, int $amount): BudgetLimit;
|
|
|
|
}
|