1<?php
2
3declare(strict_types=1);
4
5
6/**
7 * Circles - Bring cloud-users closer together.
8 *
9 * This file is licensed under the Affero General Public License version 3 or
10 * later. See the COPYING file.
11 *
12 * @author Maxence Lange <maxence@artificial-owl.com>
13 * @copyright 2021
14 * @license GNU AGPL version 3 or any later version
15 *
16 * This program is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU Affero General Public License as
18 * published by the Free Software Foundation, either version 3 of the
19 * License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 * GNU Affero General Public License for more details.
25 *
26 * You should have received a copy of the GNU Affero General Public License
27 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
28 *
29 */
30
31
32namespace OCA\Circles\Events;
33
34use OCA\Circles\Model\Federated\FederatedEvent;
35
36/**
37 * Class CircleMemberEditedEvent
38 *
39 * This Event is called when it has been confirmed that a Member have been edited on all instances used
40 * by the Circle.
41 * Meaning that the event won't be triggered until each instances have been once available during the
42 * retry-on-fail initiated in a background job
43 *
44 * WARNING: Unlike EditingCircleMemberEvent, this Event is only called on the master instance of the Circle.
45 *
46 * @package OCA\Circles\Events
47 */
48class CircleMemberEditedEvent extends CircleResultGenericEvent {
49
50
51	/** @var int */
52	private $type = 0;
53
54	/** @var int */
55	private $newLevel = 0;
56
57	/** @var string */
58	private $newDisplayName = '';
59
60
61	/**
62	 * CircleMemberEditedEvent constructor.
63	 *
64	 * @param FederatedEvent $federatedEvent
65	 * @param array $results
66	 */
67	public function __construct(FederatedEvent $federatedEvent, array $results) {
68		parent::__construct($federatedEvent, $results);
69	}
70
71	/**
72	 * @param int $type
73	 *
74	 * @return $this
75	 */
76	public function setType(int $type): self {
77		$this->type = $type;
78
79		return $this;
80	}
81
82	/**
83	 * @return int
84	 */
85	public function getType(): int {
86		return $this->type;
87	}
88
89
90	/**
91	 * @param int $newLevel
92	 *
93	 * @return CircleMemberEditedEvent
94	 */
95	public function setNewLevel(int $newLevel): self {
96		$this->newLevel = $newLevel;
97
98		return $this;
99	}
100
101	/**
102	 * @return int
103	 */
104	public function getNewLevel(): int {
105		return $this->newLevel;
106	}
107
108
109	/**
110	 * @param string $newDisplayName
111	 *
112	 * @return CircleMemberEditedEvent
113	 */
114	public function setNewDisplayName(string $newDisplayName): self {
115		$this->newDisplayName = $newDisplayName;
116
117		return $this;
118	}
119
120	/**
121	 * @return string
122	 */
123	public function getNewDisplayName(): string {
124		return $this->newDisplayName;
125	}
126}
127