1<?php
2
3declare(strict_types=1);
4/**
5 * @copyright Copyright (c) 2021 Gary Kim <gary@garykim.dev>
6 *
7 * @author Gary Kim <gary@garykim.dev>
8 *
9 * @license GNU AGPL version 3 or any later version
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Affero General Public License as
13 * published by the Free Software Foundation, either version 3 of the
14 * License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Affero General Public License for more details.
20 *
21 * You should have received a copy of the GNU Affero General Public License
22 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 *
24 */
25
26namespace OCA\Talk\Model;
27
28use OCP\AppFramework\Db\Entity;
29
30/**
31 * Class Invitation
32 *
33 * @package OCA\Talk\Model
34 *
35 * @method void setRoomId(int $roomId)
36 * @method int getRoomId()
37 * @method void setUserId(string $userId)
38 * @method string getUserId()
39 * @method void setAccessToken(string $accessToken)
40 * @method string getAccessToken()
41 * @method void setRemoteId(string $remoteId)
42 * @method string getRemoteId()
43 */
44class Invitation extends Entity {
45	/** @var int */
46	protected $roomId;
47
48	/** @var string */
49	protected $userId;
50
51	/** @var string */
52	protected $accessToken;
53
54	/** @var string */
55	protected $remoteId;
56
57	public function __construct() {
58		$this->addType('roomId', 'int');
59		$this->addType('userId', 'string');
60		$this->addType('accessToken', 'string');
61		$this->addType('remoteId', 'string');
62	}
63
64	public function asArray(): array {
65		return [
66			'id' => $this->getId(),
67			'room_id' => $this->getRoomId(),
68			'user_id' => $this->getUserId(),
69			'access_token' => $this->getAccessToken(),
70			'remote_id' => $this->getRemoteId(),
71		];
72	}
73}
74