xref: /webtrees/app/Module/ModuleDataFixInterface.php (revision d11be7027e34e3121be11cc025421873364403f9)
1ce42304aSGreg Roach<?php
2ce42304aSGreg Roach
3ce42304aSGreg Roach/**
4ce42304aSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6ce42304aSGreg Roach * This program is free software: you can redistribute it and/or modify
7ce42304aSGreg Roach * it under the terms of the GNU General Public License as published by
8ce42304aSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9ce42304aSGreg Roach * (at your option) any later version.
10ce42304aSGreg Roach * This program is distributed in the hope that it will be useful,
11ce42304aSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12ce42304aSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13ce42304aSGreg Roach * GNU General Public License for more details.
14ce42304aSGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16ce42304aSGreg Roach */
17ce42304aSGreg Roach
18ce42304aSGreg Roachdeclare(strict_types=1);
19ce42304aSGreg Roach
20ce42304aSGreg Roachnamespace Fisharebest\Webtrees\Module;
21ce42304aSGreg Roach
22ce42304aSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
23ce42304aSGreg Roachuse Fisharebest\Webtrees\Tree;
24ce42304aSGreg Roachuse Illuminate\Support\Collection;
25ce42304aSGreg Roach
26ce42304aSGreg Roach/**
27ce42304aSGreg Roach * Interface ModuleDataFixInterface - Classes and libraries for module system
28ce42304aSGreg Roach */
29ce42304aSGreg Roachinterface ModuleDataFixInterface extends ModuleInterface
30ce42304aSGreg Roach{
31ce42304aSGreg Roach    /**
32ce42304aSGreg Roach     * Options form.
33ce42304aSGreg Roach     *
34ce42304aSGreg Roach     * @param Tree $tree
35ce42304aSGreg Roach     *
36ce42304aSGreg Roach     * @return string
37ce42304aSGreg Roach     */
38ce42304aSGreg Roach    public function fixOptions(Tree $tree): string;
39ce42304aSGreg Roach
40ce42304aSGreg Roach    /**
41ce42304aSGreg Roach     * A combined list of all records that might need fixing.
42ce42304aSGreg Roach     *
43ce42304aSGreg Roach     * @param Tree                 $tree
44ce42304aSGreg Roach     * @param array<string,string> $params
45ce42304aSGreg Roach     *
4636779af1SGreg Roach     * @return Collection<int,object>
47ce42304aSGreg Roach     */
48ce42304aSGreg Roach    public function recordsToFix(Tree $tree, array $params): Collection;
49ce42304aSGreg Roach
50ce42304aSGreg Roach    /**
51ce42304aSGreg Roach     * Does a record need updating?
52ce42304aSGreg Roach     *
53ce42304aSGreg Roach     * @param GedcomRecord         $record
54ce42304aSGreg Roach     * @param array<string,string> $params
55ce42304aSGreg Roach     *
56ce42304aSGreg Roach     * @return bool
57ce42304aSGreg Roach     */
58ce42304aSGreg Roach    public function doesRecordNeedUpdate(GedcomRecord $record, array $params): bool;
59ce42304aSGreg Roach
60ce42304aSGreg Roach    /**
61ce42304aSGreg Roach     * Show the changes we would make
62ce42304aSGreg Roach     *
63ce42304aSGreg Roach     * @param GedcomRecord         $record
64ce42304aSGreg Roach     * @param array<string,string> $params
65ce42304aSGreg Roach     *
66ce42304aSGreg Roach     * @return string
67ce42304aSGreg Roach     */
68ce42304aSGreg Roach    public function previewUpdate(GedcomRecord $record, array $params): string;
69ce42304aSGreg Roach
70ce42304aSGreg Roach    /**
71ce42304aSGreg Roach     * Fix a record
72ce42304aSGreg Roach     *
73ce42304aSGreg Roach     * @param GedcomRecord         $record
74ce42304aSGreg Roach     * @param array<string,string> $params
75ce42304aSGreg Roach     *
76ce42304aSGreg Roach     * @return void
77ce42304aSGreg Roach     */
78ce42304aSGreg Roach    public function updateRecord(GedcomRecord $record, array $params): void;
79ce42304aSGreg Roach}
80