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.JsonCreator;
019import com.fasterxml.jackson.annotation.JsonValue;
020
021/**
022 * Represents the possible states in {@link RenderResponse#getStatus()}.
023 *
024 * @since 8.6.0
025 */
026public enum RenderStatus {
027
028        /**
029         * The Vonage Video API platform is in the process of connecting to the remote application at the URL provided.
030         * This is the initial state.
031         */
032        STARTING,
033
034        /**
035         * The Vonage Video API platform has successfully connected to the remote application server, and is
036         * publishing the web view to a Vonage Video stream.
037         */
038        STARTED,
039
040        /**
041         * The Experience Composer has stopped.
042         */
043        STOPPED,
044
045        /**
046         * An error occurred and the Experience Composer could not proceed. It may occur at startup if the Vonage server
047         * cannot connect to the remote application server or republish the stream. It may also occur at any point during
048         * the process due to an error in the Vonage Video API platform.
049         */
050        FAILED;
051
052        @JsonCreator
053        public static RenderStatus fromString(String status) {
054                try {
055                        return RenderStatus.valueOf(status.toUpperCase());
056                }
057                catch (NullPointerException | IllegalArgumentException e) {
058                        return null;
059                }
060        }
061
062        @JsonValue
063        @Override
064        public String toString() {
065                return name().toLowerCase();
066        }
067}