firefly-iii/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php

97 lines
2.7 KiB
PHP
Raw Normal View History

2016-01-15 04:16:41 -06:00
<?php
2022-12-29 12:42:26 -06:00
/**
* RuleGroupRepositoryInterface.php
2020-02-16 07:00:57 -06:00
* Copyright (c) 2019 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* 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
*
* 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
* GNU Affero General Public License for more details.
2017-10-21 01:40:00 -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/>.
*/
declare(strict_types=1);
2016-01-15 04:16:41 -06:00
namespace FireflyIII\Repositories\RuleGroup;
use FireflyIII\Models\RuleGroup;
use FireflyIII\User;
2023-02-19 01:43:28 -06:00
use Illuminate\Contracts\Auth\Authenticatable;
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
*/
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;
2017-07-23 12:06:24 -05:00
public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool;
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;
/**
2018-02-28 14:32:59 -06:00
* Get all rule groups.
*/
2016-04-06 02:27:45 -05:00
public function get(): Collection;
2019-05-29 11:28:28 -05:00
public function getActiveGroups(): Collection;
2018-12-07 08:36:04 -06:00
public function getActiveRules(RuleGroup $group): Collection;
public function getActiveStoreRules(RuleGroup $group): Collection;
public function getActiveUpdateRules(RuleGroup $group): Collection;
/**
* Also inactive groups.
*/
public function getAllRuleGroupsWithRules(?string $filter): Collection;
public function getHighestOrderRuleGroup(): int;
public function getRuleGroupsWithRules(?string $filter): Collection;
2021-04-16 22:39:56 -05: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;
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;
2016-04-06 02:27:45 -05:00
public function store(array $data): RuleGroup;
2016-04-06 02:27:45 -05:00
public function update(RuleGroup $ruleGroup, array $data): RuleGroup;
}