3 * @copyright Copyright (C) 2010-2023, the Friendica project
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Moderation\Entity;
24 use Friendica\Moderation\Collection;
27 * @property-read int $id
28 * @property-read int $reporterCid
29 * @property-read int $cid
30 * @property-read int $gsid
31 * @property-read string $comment
32 * @property-read string $publicRemarks
33 * @property-read string $privateRemarks
34 * @property-read bool $forward
35 * @property-read int $category
36 * @property-read int $status
37 * @property-read int|null $resolution
38 * @property-read int $reporterUid
39 * @property-read int|null $lastEditorUid
40 * @property-read int|null $assignedUid
41 * @property-read \DateTimeImmutable $created
42 * @property-read \DateTimeImmutable|null $edited
43 * @property-read Collection\Report\Posts $posts
44 * @property-read Collection\Report\Rules $rules
46 final class Report extends \Friendica\BaseEntity
48 const CATEGORY_OTHER = 1;
49 const CATEGORY_SPAM = 2;
50 const CATEGORY_ILLEGAL = 4;
51 const CATEGORY_SAFETY = 8;
52 const CATEGORY_UNWANTED = 16;
53 const CATEGORY_VIOLATION = 32;
58 self::CATEGORY_ILLEGAL,
59 self::CATEGORY_SAFETY,
60 self::CATEGORY_UNWANTED,
61 self::CATEGORY_VIOLATION,
64 const STATUS_CLOSED = 0;
65 const STATUS_OPEN = 1;
67 const RESOLUTION_ACCEPTED = 0;
68 const RESOLUTION_REJECTED = 1;
72 /** @var int ID of the contact making a moderation report */
73 protected $reporterCid;
74 /** @var int ID of the contact being reported */
76 /** @var int ID of the gserver of the contact being reported */
78 /** @var string Reporter comment */
80 /** @var int One of CATEGORY_* */
82 /** @var int ID of the user making a moderation report, null in case of an incoming forwarded report */
83 protected $reporterUid;
84 /** @var bool Whether this report should be forwarded to the remote server */
86 /** @var \DateTimeImmutable When the report was created */
88 /** @var Collection\Report\Rules List of terms of service rule lines being possibly violated */
90 /** @var Collection\Report\Posts List of URI IDs of posts supporting the report */
92 /** @var string Remarks shared with the reporter */
93 protected $publicRemarks;
94 /** @var string Remarks shared with the moderation team */
95 protected $privateRemarks;
96 /** @var \DateTimeImmutable|null When the report was last edited */
98 /** @var int One of STATUS_* */
100 /** @var int|null One of RESOLUTION_* if any */
101 protected $resolution;
102 /** @var int|null Assigned moderator user id if any */
103 protected $assignedUid;
104 /** @var int|null Last editor user ID if any */
105 protected $lastEditorUid;
107 public function __construct(
111 \DateTimeImmutable $created,
113 int $reporterUid = null,
114 string $comment = '',
115 bool $forward = false,
116 Collection\Report\Posts $posts = null,
117 Collection\Report\Rules $rules = null,
118 string $publicRemarks = '',
119 string $privateRemarks = '',
120 \DateTimeImmutable $edited = null,
121 int $status = self::STATUS_OPEN,
122 int $resolution = null,
123 int $assignedUid = null,
124 int $lastEditorUid = null,
127 $this->reporterCid = $reporterCid;
130 $this->created = $created;
131 $this->category = $category;
132 $this->reporterUid = $reporterUid;
133 $this->comment = $comment;
134 $this->forward = $forward;
135 $this->posts = $posts ?? new Collection\Report\Posts();
136 $this->rules = $rules ?? new Collection\Report\Rules();
137 $this->publicRemarks = $publicRemarks;
138 $this->privateRemarks = $privateRemarks;
139 $this->edited = $edited;
140 $this->status = $status;
141 $this->resolution = $resolution;
142 $this->assignedUid = $assignedUid;
143 $this->lastEditorUid = $lastEditorUid;