firefly-iii/app/Repositories/Account/AccountRepositoryInterface.php

190 lines
4.6 KiB
PHP
Raw Normal View History

2015-02-09 00:23:39 -06:00
<?php
2016-02-05 05:08:25 -06:00
declare(strict_types = 1);
2015-02-09 00:23:39 -06:00
namespace FireflyIII\Repositories\Account;
2015-03-29 14:27:51 -05:00
use Carbon\Carbon;
use FireflyIII\Models\Account;
2016-03-12 04:07:54 -06:00
use FireflyIII\Models\AccountMeta;
2015-03-13 02:44:07 -05:00
use FireflyIII\Models\Preference;
use FireflyIII\Models\Transaction;
2015-03-29 14:27:51 -05:00
use FireflyIII\Models\TransactionJournal;
2015-04-07 11:48:34 -05:00
use Illuminate\Pagination\LengthAwarePaginator;
2015-03-13 02:44:07 -05:00
use Illuminate\Support\Collection;
2015-03-29 14:27:51 -05:00
2015-02-11 00:35:10 -06:00
/**
* Interface AccountRepositoryInterface
*
* @package FireflyIII\Repositories\Account
*/
2015-02-09 00:23:39 -06:00
interface AccountRepositoryInterface
{
/**
* @param array $types
*
* @return int
*/
2016-02-06 09:22:12 -06:00
public function countAccounts(array $types): int;
/**
* @param Account $account
2015-07-10 13:48:45 -05:00
* @param Account $moveTo
*
2016-04-06 02:27:45 -05:00
* @return bool
*/
2016-03-12 04:05:26 -06:00
public function destroy(Account $account, Account $moveTo): bool;
2015-03-13 02:44:07 -05:00
/**
2016-02-05 02:25:15 -06:00
* @param int $accountId
*
2016-01-19 06:59:54 -06:00
* @return Account
*/
2016-02-06 09:22:12 -06:00
public function find(int $accountId): Account;
/**
* Gets all the accounts by ID, for a given set.
*
* @param array $ids
*
2016-02-23 08:54:13 -06:00
* @return \Illuminate\Support\Collection
*/
2016-02-06 09:22:12 -06:00
public function get(array $ids): Collection;
/**
2016-01-19 06:59:54 -06:00
* @param array $types
*
2016-01-19 06:59:54 -06:00
* @return Collection
2015-03-13 02:44:07 -05:00
*/
2016-02-06 09:22:12 -06:00
public function getAccounts(array $types): Collection;
2015-03-13 02:44:07 -05:00
2015-04-07 03:14:10 -05:00
/**
2015-12-27 00:59:00 -06:00
* This method returns the users credit cards, along with some basic information about the
* balance they have on their CC. To be used in the JSON boxes on the front page that say
* how many bills there are still left to pay. The balance will be saved in field "balance".
*
* To get the balance, the field "date" is necessary.
*
* @param Carbon $date
*
2015-04-07 03:14:10 -05:00
* @return Collection
*/
2016-02-06 09:22:12 -06:00
public function getCreditCards(Carbon $date): Collection;
2015-04-07 03:14:10 -05:00
2016-04-03 04:14:36 -05:00
/**
* Returns a list of transactions TO the given (expense) $account, all from the
* given list of accounts
*
* @param Account $account
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
2016-04-05 15:00:03 -05:00
public function getExpensesByDestination(Account $account, Collection $accounts, Carbon $start, Carbon $end): Collection;
2016-04-03 04:14:36 -05:00
/**
2016-01-19 06:59:54 -06:00
* @param TransactionJournal $journal
* @param Account $account
*
2016-01-19 06:59:54 -06:00
* @return Transaction
*/
2016-02-06 09:22:12 -06:00
public function getFirstTransaction(TransactionJournal $journal, Account $account): Transaction;
2015-03-13 02:44:07 -05:00
/**
* @param Preference $preference
*
* @return Collection
*/
2016-02-06 09:22:12 -06:00
public function getFrontpageAccounts(Preference $preference): Collection;
2015-03-13 02:44:07 -05:00
/**
* @param Account $account
* @param Carbon $start
* @param Carbon $end
*
2016-02-06 09:22:12 -06:00
* @return Collection
2015-03-13 02:44:07 -05:00
*/
2016-02-06 09:22:12 -06:00
public function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end): Collection;
2015-03-13 02:44:07 -05:00
2016-04-03 04:14:36 -05:00
/**
* Returns a list of transactions TO the given (asset) $account, but none from the
* given list of accounts
*
* @param Account $account
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
2016-04-05 15:00:03 -05:00
public function getIncomeByDestination(Account $account, Collection $accounts, Carbon $start, Carbon $end): Collection;
2016-04-03 04:14:36 -05:00
/**
* @param Account $account
2015-05-05 03:23:01 -05:00
* @param $page
*
2015-04-07 11:48:34 -05:00
* @return LengthAwarePaginator
*/
2016-04-05 15:00:03 -05:00
public function getJournals(Account $account, int $page): LengthAwarePaginator;
2015-04-07 13:54:43 -05:00
/**
2016-01-19 06:59:54 -06:00
* Get the accounts of a user that have piggy banks connected to them.
*
* @return Collection
2015-04-07 13:54:43 -05:00
*/
2016-02-06 09:22:12 -06:00
public function getPiggyBankAccounts(): Collection;
2015-04-07 13:54:43 -05:00
2015-02-21 05:16:41 -06:00
/**
* Get savings accounts and the balance difference in the period.
2015-02-21 05:16:41 -06:00
*
* @return Collection
2015-02-21 05:16:41 -06:00
*/
2016-02-06 09:22:12 -06:00
public function getSavingsAccounts() : Collection;
2015-02-21 05:16:41 -06:00
/**
* @param Account $account
2015-05-20 12:55:53 -05:00
* @param Carbon $date
2015-02-21 05:16:41 -06:00
*
2016-02-06 09:22:12 -06:00
* @return string
2015-02-21 05:16:41 -06:00
*/
2016-02-06 09:22:12 -06:00
public function leftOnAccount(Account $account, Carbon $date): string;
2015-02-24 14:10:25 -06:00
/**
* @param Account $account
*
2016-02-06 09:22:12 -06:00
* @return TransactionJournal
2015-02-24 14:10:25 -06:00
*/
2016-02-06 09:22:12 -06:00
public function openingBalanceTransaction(Account $account) : TransactionJournal;
2015-03-21 02:51:34 -05:00
/**
* @param array $data
2015-03-21 02:51:34 -05:00
*
* @return Account
2015-03-21 02:51:34 -05:00
*/
2016-02-06 09:22:12 -06:00
public function store(array $data) : Account;
2016-03-12 04:07:54 -06:00
/**
* @param $account
* @param $name
* @param $value
*
* @return AccountMeta
*/
2016-04-05 15:00:03 -05:00
public function storeMeta(Account $account, string $name, $value): AccountMeta;
2016-03-12 04:07:54 -06:00
2016-01-19 06:59:54 -06:00
/**
* @return string
*/
2016-02-06 09:22:12 -06:00
public function sumOfEverything() : string;
2016-01-19 06:59:54 -06:00
/**
* @param Account $account
* @param array $data
*
* @return Account
*/
2016-02-06 09:22:12 -06:00
public function update(Account $account, array $data): Account;
2015-03-29 01:14:32 -05:00
}