2023-03-25 05:32:33 -05:00
|
|
|
<?php
|
2023-04-01 00:50:53 -05:00
|
|
|
|
2023-07-15 09:02:42 -05:00
|
|
|
|
2023-03-25 05:32:33 -05:00
|
|
|
/*
|
|
|
|
* AccountRepositoryInterface.php
|
|
|
|
* Copyright (c) 2023 james@firefly-iii.org
|
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2023-07-15 09:02:42 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2023-09-21 08:50:49 -05:00
|
|
|
namespace FireflyIII\Repositories\UserGroups\Account;
|
2023-03-25 05:32:33 -05:00
|
|
|
|
2023-07-25 02:01:44 -05:00
|
|
|
use FireflyIII\Models\Account;
|
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
2023-10-29 11:41:14 -05:00
|
|
|
use FireflyIII\User;
|
2023-03-25 05:32:33 -05:00
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface AccountRepositoryInterface
|
|
|
|
*/
|
|
|
|
interface AccountRepositoryInterface
|
|
|
|
{
|
2023-10-29 11:41:14 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setUser(User $user): void;
|
|
|
|
|
2023-03-25 05:32:33 -05:00
|
|
|
/**
|
2023-08-01 02:27:39 -05:00
|
|
|
* @param int $accountId
|
2023-03-25 05:32:33 -05:00
|
|
|
*
|
2023-08-01 02:27:39 -05:00
|
|
|
* @return Account|null
|
2023-03-25 05:32:33 -05:00
|
|
|
*/
|
2023-08-01 02:27:39 -05:00
|
|
|
public function find(int $accountId): ?Account;
|
2023-07-25 02:01:44 -05:00
|
|
|
|
2023-09-23 00:15:41 -05:00
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return Account|null
|
|
|
|
*/
|
|
|
|
public function findByName(string $name, array $types): ?Account;
|
|
|
|
|
2023-07-25 02:01:44 -05:00
|
|
|
/**
|
2023-08-01 02:27:39 -05:00
|
|
|
* @param Account $account
|
2023-07-25 02:01:44 -05:00
|
|
|
*
|
2023-08-01 02:27:39 -05:00
|
|
|
* @return TransactionCurrency|null
|
2023-07-25 02:01:44 -05:00
|
|
|
*/
|
2023-08-01 02:27:39 -05:00
|
|
|
public function getAccountCurrency(Account $account): ?TransactionCurrency;
|
2023-07-25 02:01:44 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $accountIds
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getAccountsById(array $accountIds): Collection;
|
|
|
|
|
|
|
|
/**
|
2023-08-01 02:27:39 -05:00
|
|
|
* @param array $types
|
|
|
|
* @param array|null $sort
|
2023-07-25 02:01:44 -05:00
|
|
|
*
|
2023-08-01 02:27:39 -05:00
|
|
|
* @return Collection
|
2023-07-25 02:01:44 -05:00
|
|
|
*/
|
2023-08-01 02:27:39 -05:00
|
|
|
public function getAccountsByType(array $types, ?array $sort = []): Collection;
|
2023-07-25 02:01:44 -05:00
|
|
|
|
2023-08-06 04:22:36 -05:00
|
|
|
/**
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveAccountsByType(array $types): Collection;
|
|
|
|
|
2023-07-25 02:01:44 -05:00
|
|
|
/**
|
|
|
|
* Return meta value for account. Null if not found.
|
|
|
|
*
|
|
|
|
* @param Account $account
|
2023-08-01 02:27:39 -05:00
|
|
|
* @param string $field
|
2023-07-25 02:01:44 -05:00
|
|
|
*
|
|
|
|
* @return null|string
|
|
|
|
*/
|
|
|
|
public function getMetaValue(Account $account, string $field): ?string;
|
2023-08-01 02:27:39 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $query
|
|
|
|
* @param array $types
|
|
|
|
* @param int $limit
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function searchAccount(string $query, array $types, int $limit): Collection;
|
|
|
|
|
2023-09-23 00:19:20 -05:00
|
|
|
|
2023-03-25 05:32:33 -05:00
|
|
|
}
|