2015-02-09 00:23:39 -06:00
|
|
|
<?php
|
2016-05-20 05:41:23 -05:00
|
|
|
/**
|
|
|
|
* AccountRepositoryInterface.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-04 23:52:15 -05:00
|
|
|
* 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.
|
2016-05-20 05:41:23 -05:00
|
|
|
*/
|
|
|
|
|
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;
|
2015-02-14 07:25:29 -06:00
|
|
|
use FireflyIII\Models\Account;
|
2016-10-10 00:25:27 -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
|
|
|
|
{
|
2016-10-09 01:20:29 -05:00
|
|
|
|
2016-10-09 01:18:47 -05:00
|
|
|
/**
|
|
|
|
* Moved here from account CRUD.
|
|
|
|
*
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function count(array $types): int;
|
2016-02-04 01:53:15 -06:00
|
|
|
|
2016-10-09 01:20:29 -05:00
|
|
|
/**
|
|
|
|
* Moved here from account CRUD.
|
|
|
|
*
|
|
|
|
* @param Account $account
|
|
|
|
* @param Account $moveTo
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function destroy(Account $account, Account $moveTo): bool;
|
|
|
|
|
2016-10-10 00:12:39 -05:00
|
|
|
/**
|
|
|
|
* @param int $accountId
|
|
|
|
*
|
|
|
|
* @return Account
|
|
|
|
*/
|
|
|
|
public function find(int $accountId): Account;
|
|
|
|
|
2016-10-10 00:14:01 -05:00
|
|
|
/**
|
|
|
|
* @param string $number
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return Account
|
|
|
|
*/
|
|
|
|
public function findByAccountNumber(string $number, array $types): Account;
|
|
|
|
|
2016-10-10 00:16:05 -05:00
|
|
|
/**
|
|
|
|
* @param string $iban
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return Account
|
|
|
|
*/
|
|
|
|
public function findByIban(string $iban, array $types): Account;
|
|
|
|
|
2016-10-10 00:49:39 -05:00
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return Account
|
|
|
|
*/
|
|
|
|
public function findByName(string $name, array $types): Account;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $accountIds
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getAccountsById(array $accountIds): Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getAccountsByType(array $types): Collection;
|
|
|
|
|
2016-10-10 00:53:12 -05:00
|
|
|
/**
|
|
|
|
* @param array $types
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveAccountsByType(array $types): Collection;
|
|
|
|
|
2016-11-21 13:23:25 -06:00
|
|
|
/**
|
|
|
|
* Returns the date of the very last transaction in this account.
|
|
|
|
*
|
|
|
|
* @param Account $account
|
|
|
|
*
|
|
|
|
* @return Carbon
|
|
|
|
*/
|
|
|
|
public function newestJournalDate(Account $account): Carbon;
|
|
|
|
|
2016-04-08 07:50:18 -05:00
|
|
|
/**
|
|
|
|
* Returns the date of the very first transaction in this account.
|
|
|
|
*
|
|
|
|
* @param Account $account
|
|
|
|
*
|
|
|
|
* @return Carbon
|
|
|
|
*/
|
|
|
|
public function oldestJournalDate(Account $account): Carbon;
|
|
|
|
|
2016-10-10 01:03:03 -05:00
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return Account
|
|
|
|
*/
|
2016-11-28 11:55:56 -06:00
|
|
|
public function store(array $data): Account;
|
2016-10-10 01:03:03 -05:00
|
|
|
|
2015-03-29 01:14:32 -05:00
|
|
|
}
|