2016-01-15 04:16:41 -06:00
|
|
|
<?php
|
2016-05-20 05:41:23 -05:00
|
|
|
/**
|
|
|
|
* RuleGroupRepositoryInterface.php
|
2017-10-21 01:40:00 -05:00
|
|
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
2016-05-20 05:41:23 -05:00
|
|
|
*
|
2017-10-21 01:40:00 -05:00
|
|
|
* This file is part of Firefly III.
|
2016-10-04 23:52:15 -05:00
|
|
|
*
|
2017-10-21 01:40:00 -05: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 07:44:05 -06:00
|
|
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
2016-05-20 05:41:23 -05:00
|
|
|
*/
|
2017-04-09 00:44:22 -05:00
|
|
|
declare(strict_types=1);
|
2016-01-15 04:16:41 -06:00
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\RuleGroup;
|
|
|
|
|
2016-01-15 04:27:27 -06:00
|
|
|
use FireflyIII\Models\RuleGroup;
|
2016-02-17 10:27:41 -06:00
|
|
|
use FireflyIII\User;
|
2016-01-15 04:27:27 -06:00
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
2016-01-15 06:13:21 -06:00
|
|
|
/**
|
2017-11-15 05:25:49 -06:00
|
|
|
* Interface RuleGroupRepositoryInterface.
|
2016-01-15 06:13:21 -06:00
|
|
|
*/
|
2016-01-15 04:27:27 -06:00
|
|
|
interface RuleGroupRepositoryInterface
|
2016-01-15 04:16:41 -06:00
|
|
|
{
|
2016-01-24 09:50:55 -06:00
|
|
|
/**
|
|
|
|
* @return int
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function count(): int;
|
2016-01-24 09:50:55 -06:00
|
|
|
|
2016-01-15 04:27:27 -06:00
|
|
|
/**
|
2017-01-14 12:43:33 -06:00
|
|
|
* @param RuleGroup $ruleGroup
|
|
|
|
* @param RuleGroup|null $moveTo
|
2016-01-15 04:27:27 -06:00
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2017-07-23 12:06:24 -05:00
|
|
|
public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
2016-10-23 05:10:22 -05:00
|
|
|
/**
|
|
|
|
* @param int $ruleGroupId
|
|
|
|
*
|
|
|
|
* @return RuleGroup
|
|
|
|
*/
|
|
|
|
public function find(int $ruleGroupId): RuleGroup;
|
|
|
|
|
2016-01-15 04:27:27 -06:00
|
|
|
/**
|
2018-02-28 14:32:59 -06:00
|
|
|
* Get all rule groups.
|
|
|
|
*
|
2016-01-19 06:59:54 -06:00
|
|
|
* @return Collection
|
2016-01-15 04:27:27 -06:00
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function get(): Collection;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
2017-04-28 03:34:11 -05:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getActiveGroups(User $user): Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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 04:27:27 -06:00
|
|
|
/**
|
2016-01-19 06:59:54 -06:00
|
|
|
* @return int
|
2016-01-15 04:27:27 -06:00
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function getHighestOrderRuleGroup(): int;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
2016-02-17 10:27:41 -06:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getRuleGroupsWithRules(User $user): Collection;
|
|
|
|
|
2016-01-15 04:27:27 -06:00
|
|
|
/**
|
|
|
|
* @param RuleGroup $ruleGroup
|
2016-01-15 06:13:21 -06:00
|
|
|
*
|
2016-01-15 04:27:27 -06:00
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function moveDown(RuleGroup $ruleGroup): bool;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param RuleGroup $ruleGroup
|
2016-01-15 06:13:21 -06:00
|
|
|
*
|
2016-01-15 04:27:27 -06:00
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function moveUp(RuleGroup $ruleGroup): bool;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function resetRuleGroupOrder(): bool;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
|
|
|
/**
|
2016-01-15 10:38:09 -06:00
|
|
|
* @param RuleGroup $ruleGroup
|
|
|
|
*
|
2016-01-15 04:27:27 -06:00
|
|
|
* @return bool
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
2017-01-30 09:40:49 -06:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*/
|
|
|
|
public function setUser(User $user);
|
|
|
|
|
2016-01-15 04:27:27 -06:00
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return RuleGroup
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function store(array $data): RuleGroup;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param RuleGroup $ruleGroup
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return RuleGroup
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function update(RuleGroup $ruleGroup, array $data): RuleGroup;
|
2016-01-28 14:50:20 -06:00
|
|
|
}
|