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.video;
017
018import com.fasterxml.jackson.annotation.JsonAlias;
019import com.fasterxml.jackson.annotation.JsonProperty;
020import com.vonage.client.JsonableBaseObject;
021import java.net.URI;
022import java.util.UUID;
023
024/**
025 * Represents an Experience Composer response.
026 *
027 * @since 8.6.0
028 */
029public class RenderResponse extends JsonableBaseObject {
030        private UUID id, applicationId, streamId;
031        private String sessionId, name, reason;
032        private Long createdAt, updatedAt;
033        private URI url, callbackUrl;
034        private Resolution resolution;
035        private RenderStatus status;
036
037        protected RenderResponse() {}
038
039        /**
040         * Unique identifier for the Experience Composer.
041         *
042         * @return The render ID.
043         */
044        @JsonProperty("id")
045        public UUID getId() {
046                return id;
047        }
048
049        /**
050         * Session ID of the Vonage Video session you are working with.
051         *
052         * @return The Vonage Video session ID.
053         */
054        @JsonProperty("sessionId")
055        public String getSessionId() {
056                return sessionId;
057        }
058
059        /**
060         * Vonage Application ID.
061         *
062         * @return The application UUID.
063         */
064        @JsonAlias("projectId")
065        @JsonProperty("applicationId")
066        public UUID getApplicationId() {
067                return applicationId;
068        }
069
070        /**
071         * The time the Experience Composer started, expressed in milliseconds since the Unix epoch.
072         *
073         * @return The render start time as a Long.
074         */
075        @JsonProperty("createdAt")
076        public Long getCreatedAt() {
077                return createdAt;
078        }
079
080        /**
081         * UNIX timestamp when the Experience Composer status was last updated. When starting an Experience Composer
082         * for the first time, this will be the same as {@linkplain #getCreatedAt()}.
083         *
084         * @return The last update time as a Long.
085         */
086        @JsonProperty("updatedAt")
087        public Long getUpdatedAt() {
088                return updatedAt;
089        }
090
091        /**
092         * A publicly reachable URL controlled by the customer and capable of generating the
093         * content to be rendered without user intervention.
094         *
095         * @return The URL.
096         */
097        @JsonProperty("url")
098        public URI getUrl() {
099                return url;
100        }
101
102        /**
103         * Callback URL for Experience Composer events (if one was set).
104         *
105         * @return The callback URL, or {@code null} if unspecified.
106         */
107        @JsonProperty("callbackUrl")
108        public URI getCallbackUrl() {
109                return callbackUrl;
110        }
111
112        /**
113         * Output resolution of the Experience Composer (either "640x480", "1280x720", "480x640", or "720x1280").
114         *
115         * @return The render resolution as an enum.
116         */
117        @JsonProperty("resolution")
118        public Resolution getResolution() {
119                return resolution;
120        }
121
122        /**
123         * Status of the Experience Composer.
124         *
125         * @return The render status as an enum.
126         */
127        @JsonProperty("status")
128        public RenderStatus getStatus() {
129                return status;
130        }
131
132        /**
133         * ID of the composed stream being published. This is not available when the status is
134         * {@linkplain RenderStatus#STARTING} and may not be available when the status is {@linkplain RenderStatus#FAILED}.
135         *
136         * @return The stream ID, or {@code null} if unavailable.
137         */
138        @JsonProperty("streamId")
139        public UUID getStreamId() {
140                return streamId;
141        }
142
143        /**
144         * Name of the composed output stream which is published to the session.
145         *
146         * @return The render name.
147         * @since 8.12.0
148         */
149        @JsonProperty("name")
150        public String getName() {
151                return name;
152        }
153
154        /**
155         * The reason field is only available when the status is either {@linkplain RenderStatus#STOPPED} or
156         * {@linkplain RenderStatus#FAILED}. If the status is "stopped", the reason field will contain either
157         * "Max Duration Exceeded" or "Stop Requested." If the status is "failed", the reason will contain a
158         * more specific error message.
159         *
160         * @return The reason, or {@code null} if not applicable.
161         */
162        @JsonProperty("reason")
163        public String getReason() {
164                return reason;
165        }
166}