2016-01-15 11:16:41 +01:00
|
|
|
<?php
|
2016-05-20 12:41:23 +02:00
|
|
|
/**
|
|
|
|
* RuleGroupRepositoryInterface.php
|
2017-10-21 08:40:00 +02:00
|
|
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
2016-05-20 12:41:23 +02:00
|
|
|
*
|
2017-10-21 08:40:00 +02:00
|
|
|
* This file is part of Firefly III.
|
2016-10-05 06:52:15 +02:00
|
|
|
*
|
2017-10-21 08:40:00 +02:00
|
|
|
* Firefly III is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Firefly III 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2017-12-17 14:44:05 +01:00
|
|
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
2016-05-20 12:41:23 +02:00
|
|
|
*/
|
2017-04-09 07:44:22 +02:00
|
|
|
declare(strict_types=1);
|
2016-01-15 11:16:41 +01:00
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\RuleGroup;
|
|
|
|
|
2016-01-15 11:27:27 +01:00
|
|
|
use FireflyIII\Models\RuleGroup;
|
2016-02-17 17:27:41 +01:00
|
|
|
use FireflyIII\User;
|
2016-01-15 11:27:27 +01:00
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
2016-01-15 13:13:21 +01:00
|
|
|
/**
|
2017-11-15 12:25:49 +01:00
|
|
|
* Interface RuleGroupRepositoryInterface.
|
2016-01-15 13:13:21 +01:00
|
|
|
*/
|
2016-01-15 11:27:27 +01:00
|
|
|
interface RuleGroupRepositoryInterface
|
2016-01-15 11:16:41 +01:00
|
|
|
{
|
2016-01-24 16:50:55 +01:00
|
|
|
/**
|
|
|
|
* @return int
|
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function count(): int;
|
2016-01-24 16:50:55 +01:00
|
|
|
|
2016-01-15 11:27:27 +01:00
|
|
|
/**
|
2017-01-14 19:43:33 +01:00
|
|
|
* @param RuleGroup $ruleGroup
|
|
|
|
* @param RuleGroup|null $moveTo
|
2016-01-15 11:27:27 +01:00
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2017-07-23 19:06:24 +02:00
|
|
|
public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
2016-10-23 12:10:22 +02:00
|
|
|
/**
|
|
|
|
* @param int $ruleGroupId
|
|
|
|
*
|
2018-07-22 21:09:57 +02:00
|
|
|
* @return RuleGroup|null
|
2016-10-23 12:10:22 +02:00
|
|
|
*/
|
2018-07-22 21:09:57 +02:00
|
|
|
public function find(int $ruleGroupId): ?RuleGroup;
|
2016-10-23 12:10:22 +02:00
|
|
|
|
2016-01-15 11:27:27 +01:00
|
|
|
/**
|
2018-02-28 21:32:59 +01:00
|
|
|
* Get all rule groups.
|
|
|
|
*
|
2016-01-19 13:59:54 +01:00
|
|
|
* @return Collection
|
2016-01-15 11:27:27 +01:00
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function get(): Collection;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
2017-04-28 10:34:11 +02:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveGroups(User $user): Collection;
|
|
|
|
|
2018-12-07 15:36:04 +01:00
|
|
|
/**
|
|
|
|
* @param RuleGroup $group
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveRules(RuleGroup $group): Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param RuleGroup $group
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getRules(RuleGroup $group): Collection;
|
|
|
|
|
2017-04-28 10:34:11 +02:00
|
|
|
/**
|
|
|
|
* @param RuleGroup $group
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveStoreRules(RuleGroup $group): Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param RuleGroup $group
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveUpdateRules(RuleGroup $group): Collection;
|
|
|
|
|
2016-01-15 11:27:27 +01:00
|
|
|
/**
|
2016-01-19 13:59:54 +01:00
|
|
|
* @return int
|
2016-01-15 11:27:27 +01:00
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function getHighestOrderRuleGroup(): int;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
2016-02-17 17:27:41 +01:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getRuleGroupsWithRules(User $user): Collection;
|
|
|
|
|
2016-01-15 11:27:27 +01:00
|
|
|
/**
|
|
|
|
* @param RuleGroup $ruleGroup
|
2016-01-15 13:13:21 +01:00
|
|
|
*
|
2016-01-15 11:27:27 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function moveDown(RuleGroup $ruleGroup): bool;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param RuleGroup $ruleGroup
|
2016-01-15 13:13:21 +01:00
|
|
|
*
|
2016-01-15 11:27:27 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function moveUp(RuleGroup $ruleGroup): bool;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function resetRuleGroupOrder(): bool;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
|
|
|
/**
|
2016-01-15 17:38:09 +01:00
|
|
|
* @param RuleGroup $ruleGroup
|
|
|
|
*
|
2016-01-15 11:27:27 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
2017-01-30 16:40:49 +01:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*/
|
|
|
|
public function setUser(User $user);
|
|
|
|
|
2016-01-15 11:27:27 +01:00
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return RuleGroup
|
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function store(array $data): RuleGroup;
|
2016-01-15 11:27:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param RuleGroup $ruleGroup
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return RuleGroup
|
|
|
|
*/
|
2016-04-06 09:27:45 +02:00
|
|
|
public function update(RuleGroup $ruleGroup, array $data): RuleGroup;
|
2016-01-28 21:50:20 +01:00
|
|
|
}
|