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 * Defines values returned by the {@link Archive#getStatus} method.
023 */
024public enum ArchiveStatus {
025        /**
026         * The archive file is available for download from the cloud. You can get the URL of the download file by
027         * calling the {@link Archive#getUrl} method.
028         */
029        AVAILABLE,
030
031        /**
032         * The archive file has been deleted.
033         */
034        DELETED,
035
036        /**
037         * The recording of the archive failed.
038         */
039        FAILED,
040
041        /**
042         * The archive is in progress and no clients are publishing streams to the session. When an archive is in progress
043         * and any client publishes a stream, the status is STARTED. When an archive is PAUSED, nothing is recorded. When a
044         * client starts publishing a stream, the recording starts (or resumes). If all clients disconnect from a session
045         * that is being archived, the status changes to PAUSED, and after 60 seconds the archive recording stops (and the
046         * status changes to STOPPED).
047         */
048        PAUSED,
049
050        /**
051         * The archive recording has started and is in progress.
052         */
053        STARTED,
054
055        /**
056         * The archive recording has stopped, but the file is not available.
057         */
058        STOPPED,
059
060        /**
061         * The archive is available for download from the upload target Amazon S3 bucket or Windows Azure container you
062         * set up for your Vonage video project.
063         */
064        UPLOADED,
065
066        /**
067         * The archive file is no longer available in the cloud.
068         */
069        EXPIRED;
070
071        @JsonValue
072        @Override
073        public String toString() {
074                return name().toLowerCase();
075        }
076
077        @JsonCreator
078        public static ArchiveStatus fromString(String value) {
079                try {
080                        return ArchiveStatus.valueOf(value.toUpperCase());
081                }
082                catch (NullPointerException | IllegalArgumentException ex) {
083                        return null;
084                }
085        }
086}