001/*
002 *   Copyright 2024 Vonage
003 *
004 *   Licensed under the Apache License, Version 2.0 (the "License");
005 *   you may not use this file except in compliance with the License.
006 *   You may obtain a copy of the License at
007 *
008 *        http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *   Unless required by applicable law or agreed to in writing, software
011 *   distributed under the License is distributed on an "AS IS" BASIS,
012 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *   See the License for the specific language governing permissions and
014 *   limitations under the License.
015 */
016package com.vonage.client.meetings;
017
018import com.fasterxml.jackson.annotation.JsonProperty;
019import com.vonage.client.Jsonable;
020import com.vonage.client.JsonableBaseObject;
021import com.vonage.client.VonageResponseParseException;
022import java.net.URI;
023import java.time.Instant;
024import java.util.UUID;
025
026/**
027 * Represents a deserialized callback response webhook for event updates from the Meetings API.
028 */
029public class MeetingsEventCallback extends JsonableBaseObject {
030        private EventType event;
031        private String sessionId, participantName, participantType;
032        private UUID roomId, recordingId, participantId;
033        private RoomType roomType;
034        private Instant createdAt, startedAt, expiresAt, endedAt;
035        private Integer duration;
036        private URI recordingUrl;
037        private Boolean isHost;
038
039        protected MeetingsEventCallback() {
040        }
041
042        /**
043         * Type of event represented by this object.
044         *
045         * @return The event type as an enum.
046         */
047        @JsonProperty("event")
048        public EventType getEvent() {
049                return event;
050        }
051
052        /**
053         * Corresponds to the underlying Video API session ID.
054         *
055         * @return The session ID, or {@code null} if not applicable.
056         */
057        @JsonProperty("session_id")
058        public String getSessionId() {
059                return sessionId;
060        }
061
062        /**
063         * The participant name.
064         *
065         * @return Display name of the participant, or {@code null} if not applicable.
066         */
067        @JsonProperty("name")
068        public String getParticipantName() {
069                return participantName;
070        }
071
072        /**
073         * The participant type (e.g. "Guest").
074         *
075         * @return Type of participant, or {@code null} if not applicable.
076         */
077        @JsonProperty("type")
078        public String getParticipantType() {
079                return participantType;
080        }
081
082        /**
083         * Meeting room's ID.
084         *
085         * @return The room ID, or {@code null} if not applicable.
086         */
087        @JsonProperty("room_id")
088        public UUID getRoomId() {
089                return roomId;
090        }
091
092        /**
093         * Unique recording ID for the meeting.
094         *
095         * @return The recording ID, or {@code null} if not applicable.
096         */
097        @JsonProperty("recording_id")
098        public UUID getRecordingId() {
099                return recordingId;
100        }
101
102        /**
103         * Unique identifier for the participant.
104         *
105         * @return The participant ID, or {@code null} if not applicable.
106         */
107        @JsonProperty("participant_id")
108        public UUID getParticipantId() {
109                return participantId;
110        }
111
112        /**
113         * The type of meeting room.
114         *
115         * @return The meeting room type as an enum, or {@code null} if not applicable.
116         */
117        @JsonProperty("room_type")
118        public RoomType getRoomType() {
119                return roomType;
120        }
121
122        /**
123         * The date-time when the room will expire, expressed in ISO 8601 format.
124         *
125         * @return The room expiration timestamp, or {@code null} if not applicable.
126         */
127        @JsonProperty("expires_at")
128        public Instant getExpiresAt() {
129                return expiresAt;
130        }
131
132        /**
133         * The date-time when the room was created, expressed in ISO 8601 format.
134         *
135         * @return The room creation timestamp, or {@code null} if not applicable.
136         */
137        @JsonProperty("created_at")
138        public Instant getCreatedAt() {
139                return createdAt;
140        }
141
142        /**
143         * The date-time when the session started, expressed in ISO 8601 format.
144         *
145         * @return The start timestamp, or {@code null} if not applicable.
146         */
147        @JsonProperty("started_at")
148        public Instant getStartedAt() {
149                return startedAt;
150        }
151
152        /**
153         * The date-time the session or recording ended, expressed in ISO 8601 format.
154         *
155         * @return The end timestamp, or {@code null} if not applicable.
156         */
157        @JsonProperty("ended_at")
158        public Instant getEndedAt() {
159                return endedAt;
160        }
161
162        /**
163         * Duration of the recording in seconds.
164         *
165         * @return The duration in seconds, or {@code null} if not applicable.
166         */
167        @JsonProperty("duration")
168        public Integer getDuration() {
169                return duration;
170        }
171
172        /**
173         * URL of the uploaded recording.
174         *
175         * @return The recording URL, or {@code null} if not applicable.
176         */
177        @JsonProperty("url")
178        public URI getRecordingUrl() {
179                return recordingUrl;
180        }
181
182        /**
183         * Indicates if this participant is the session's host.
184         *
185         * @return Whether the participant is the session host, or {@code null} if not applicable.
186         */
187        @JsonProperty("is_host")
188        public Boolean getIsHost() {
189                return isHost;
190        }
191
192        /**
193         * Constructs an instance of this class from a JSON payload.
194         *
195         * @param json The webhook response JSON string.
196         *
197         * @return The deserialized webhook response object.
198         * @throws VonageResponseParseException If the response could not be deserialized.
199         */
200        public static MeetingsEventCallback fromJson(String json) {
201                return Jsonable.fromJson(json);
202        }
203}