Files
firefly-iii/app/Repositories/Budget/BudgetLimitRepositoryInterface.php

86 lines
2.9 KiB
PHP
Raw Normal View History

2019-08-29 21:33:12 +02:00
<?php
2019-08-29 21:33:12 +02:00
/**
* BudgetLimitRepositoryInterface.php
2020-02-16 14:00:57 +01:00
* Copyright (c) 2019 james@firefly-iii.org
2019-08-29 21:33:12 +02:00
*
* This file is part of Firefly III (https://github.com/firefly-iii).
2019-08-29 21:33:12 +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.
2019-08-29 21:33:12 +02:00
*
* This program is distributed in the hope that it will be useful,
2019-08-29 21:33:12 +02:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2019-08-29 21:33:12 +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/>.
2019-08-29 21:33:12 +02:00
*/
declare(strict_types=1);
namespace FireflyIII\Repositories\Budget;
2019-08-30 07:54:09 +02:00
use Carbon\Carbon;
use FireflyIII\Enums\UserRoleEnum;
2019-08-30 08:09:13 +02:00
use FireflyIII\Models\Budget;
2019-08-30 07:49:08 +02:00
use FireflyIII\Models\BudgetLimit;
2019-08-30 07:54:09 +02:00
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\UserGroup;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable;
2019-08-30 07:54:09 +02:00
use Illuminate\Support\Collection;
2019-08-29 21:33:12 +02:00
/**
* Interface BudgetLimitRepositoryInterface
*
* @method setUserGroup(UserGroup $group)
* @method getUserGroup()
* @method getUser()
* @method checkUserGroupAccess(UserRoleEnum $role)
* @method setUser(null|Authenticatable|User $user)
* @method setUserGroupById(int $userGroupId)
2019-08-29 21:33:12 +02:00
*/
interface BudgetLimitRepositoryInterface
{
/**
* Tells you which amount has been budgeted (for the given budgets)
* in the selected query. Returns a positive amount as a string.
*/
public function budgeted(Carbon $start, Carbon $end, TransactionCurrency $currency, ?Collection $budgets = null): string;
2021-03-12 06:20:01 +01:00
/**
* Destroy all budget limits.
*/
public function destroyAll(): void;
2019-08-30 07:49:08 +02:00
/**
* Destroy a budget limit.
*/
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void;
public function find(Budget $budget, TransactionCurrency $currency, Carbon $start, Carbon $end): ?BudgetLimit;
2019-08-30 07:54:09 +02:00
/**
2022-10-30 11:43:17 +01:00
* TODO this method is not multi currency aware.
2019-08-30 07:54:09 +02:00
*/
public function getAllBudgetLimits(?Carbon $start = null, ?Carbon $end = null): Collection;
2019-08-30 07:54:09 +02:00
public function getAllBudgetLimitsByCurrency(TransactionCurrency $currency, ?Carbon $start = null, ?Carbon $end = null): Collection;
2019-08-30 07:54:09 +02:00
public function getBudgetLimits(Budget $budget, ?Carbon $start = null, ?Carbon $end = null): Collection;
2019-08-30 08:09:13 +02:00
2024-12-22 08:43:12 +01:00
public function getNoteText(BudgetLimit $budgetLimit): string;
public function setNoteText(BudgetLimit $budgetLimit, string $text): void;
public function store(array $data): BudgetLimit;
2019-08-30 09:19:29 +02:00
public function update(BudgetLimit $budgetLimit, array $data): BudgetLimit;
// public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): ?BudgetLimit;
}