2016-01-15 04:16:41 -06:00
|
|
|
<?php
|
2022-12-29 12:42:26 -06:00
|
|
|
|
2016-05-20 05:41:23 -05:00
|
|
|
/**
|
|
|
|
* RuleGroupRepositoryInterface.php
|
2020-02-16 07:00:57 -06:00
|
|
|
* Copyright (c) 2019 james@firefly-iii.org
|
2016-05-20 05:41:23 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2016-10-04 23:52:15 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* 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.
|
2017-10-21 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2017-10-21 01:40:00 -05:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-01 23:37:26 -05:00
|
|
|
* GNU Affero General Public License for more details.
|
2017-10-21 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* 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/>.
|
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;
|
2023-02-19 01:43:28 -06:00
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
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
|
|
|
{
|
2021-03-10 23:29:07 -06:00
|
|
|
/**
|
|
|
|
* Make sure rule group order is correct in DB.
|
|
|
|
*/
|
|
|
|
public function correctRuleGroupOrder(): void;
|
|
|
|
|
2016-04-06 02:27:45 -05:00
|
|
|
public function count(): int;
|
2016-01-24 09:50:55 -06:00
|
|
|
|
2017-07-23 12:06:24 -05:00
|
|
|
public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
2021-03-11 23:20:01 -06:00
|
|
|
/**
|
|
|
|
* Delete everything.
|
|
|
|
*/
|
|
|
|
public function destroyAll(): void;
|
|
|
|
|
2018-07-22 14:09:57 -05:00
|
|
|
public function find(int $ruleGroupId): ?RuleGroup;
|
2016-10-23 05:10:22 -05:00
|
|
|
|
2019-06-12 23:39:05 -05:00
|
|
|
public function findByTitle(string $title): ?RuleGroup;
|
|
|
|
|
2016-01-15 04:27:27 -06:00
|
|
|
/**
|
2018-02-28 14:32:59 -06:00
|
|
|
* Get all rule groups.
|
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
|
|
|
|
2019-05-29 11:28:28 -05:00
|
|
|
public function getActiveGroups(): Collection;
|
2017-04-28 03:34:11 -05:00
|
|
|
|
2018-12-07 08:36:04 -06:00
|
|
|
public function getActiveRules(RuleGroup $group): Collection;
|
|
|
|
|
2017-04-28 03:34:11 -05:00
|
|
|
public function getActiveStoreRules(RuleGroup $group): Collection;
|
|
|
|
|
|
|
|
public function getActiveUpdateRules(RuleGroup $group): Collection;
|
|
|
|
|
2016-01-15 04:27:27 -06:00
|
|
|
/**
|
2021-09-18 03:26:12 -05:00
|
|
|
* Also inactive groups.
|
2016-02-17 10:27:41 -06:00
|
|
|
*/
|
2021-09-18 03:26:12 -05:00
|
|
|
public function getAllRuleGroupsWithRules(?string $filter): Collection;
|
|
|
|
|
|
|
|
public function getHighestOrderRuleGroup(): int;
|
2016-02-17 10:27:41 -06:00
|
|
|
|
2021-09-18 03:26:12 -05:00
|
|
|
public function getRuleGroupsWithRules(?string $filter): Collection;
|
2021-04-16 22:39:56 -05:00
|
|
|
|
2019-02-12 14:49:28 -06:00
|
|
|
public function getRules(RuleGroup $group): Collection;
|
|
|
|
|
2021-03-11 23:20:01 -06:00
|
|
|
/**
|
|
|
|
* Get highest possible order for a rule group.
|
|
|
|
*/
|
|
|
|
public function maxOrder(): int;
|
|
|
|
|
2021-03-14 04:41:17 -05:00
|
|
|
public function resetOrder(): bool;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
2021-03-14 04:41:17 -05:00
|
|
|
public function resetRuleOrder(RuleGroup $ruleGroup): bool;
|
|
|
|
|
2021-03-11 23:20:01 -06:00
|
|
|
public function searchRuleGroup(string $query, int $limit): Collection;
|
|
|
|
|
2021-03-21 03:15:40 -05:00
|
|
|
public function setOrder(RuleGroup $ruleGroup, int $newOrder): void;
|
|
|
|
|
2023-12-20 12:35:52 -06:00
|
|
|
public function setUser(null|Authenticatable|User $user): void;
|
2017-01-30 09:40:49 -06:00
|
|
|
|
2016-04-06 02:27:45 -05:00
|
|
|
public function store(array $data): RuleGroup;
|
2016-01-15 04:27:27 -06:00
|
|
|
|
2016-04-06 02:27:45 -05:00
|
|
|
public function update(RuleGroup $ruleGroup, array $data): RuleGroup;
|
2016-01-28 14:50:20 -06:00
|
|
|
}
|