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.JsonIgnore;
019import com.fasterxml.jackson.annotation.JsonProperty;
020import com.vonage.client.Jsonable;
021import com.vonage.client.JsonableBaseObject;
022import java.net.URI;
023import java.time.Instant;
024import java.util.UUID;
025
026public class Recording extends JsonableBaseObject {
027        private UUID id;
028        private String sessionId;
029        private Instant startedAt, endedAt;
030        private RecordingStatus status;
031        @JsonProperty("_links") private RecordingLinks links;
032
033        protected Recording() {
034        }
035
036        /**
037         * Identifier of the recording.
038         *
039         * @return The recording ID.
040         */
041        @JsonProperty("id")
042        public UUID getId() {
043                return id;
044        }
045
046        /**
047         * Corresponds to the underlying Video API session ID.
048         *
049         * @return The video session ID.
050         */
051        @JsonProperty("session_id")
052        public String getSessionId() {
053                return sessionId;
054        }
055
056        /**
057         * Recording start time, in ISO 8601 format.
058         *
059         * @return The recording start time.
060         */
061        @JsonProperty("started_at")
062        public Instant getStartedAt() {
063                return startedAt;
064        }
065
066        /**
067         * Recording end time, in ISO 8601 format.
068         *
069         * @return The recording end time.
070         */
071        @JsonProperty("ended_at")
072        public Instant getEndedAt() {
073                return endedAt;
074        }
075
076        /**
077         * Status of the recording.
078         *
079         * @return The recording status, as an enum.
080         */
081        @JsonProperty("status")
082        public RecordingStatus getStatus() {
083                return status;
084        }
085
086        /**
087         * The URL property of the {@code _links} response.
088         *
089         * @return The recording URL or {@code null} if not available.
090         */
091        @JsonIgnore
092        public URI getUrl() {
093                return links != null ? links.getUrl() : null;
094        }
095        
096        /**
097         * Creates an instance of this class from a JSON payload.
098         *
099         * @param json The JSON string to parse.
100         * @return An instance of this class with the fields populated, if present.
101         */
102        public static Recording fromJson(String json) {
103                return Jsonable.fromJson(json);
104        }
105}