001package com.vonage.client.video;
002
003import com.fasterxml.jackson.annotation.JsonCreator;
004import com.fasterxml.jackson.annotation.JsonValue;
005
006/**
007 * Defines values for how streams will be selected for broadcasts and archives.
008 */
009public enum StreamMode {
010        /**
011         * Streams will be automatically included in the archive or broadcast.
012         */
013        AUTO,
014
015        /**
016         * Streams will be included in the archive or broadcast based on calls to the
017         * {@link VideoClient#addArchiveStream(String, String, Boolean, Boolean)} /
018         * {@link VideoClient#addBroadcastStream(String, String, Boolean, Boolean)} and
019         * {@link VideoClient#removeArchiveStream(String, String)} /
020         * {@link VideoClient#removeBroadcastStream(String, String)} methods.
021         */
022        MANUAL;
023
024        @JsonValue
025        @Override
026        public String toString() {
027                return name().toLowerCase();
028        }
029
030        @JsonCreator
031        public static StreamMode fromString(String value) {
032                try {
033                        return StreamMode.valueOf(value.toUpperCase());
034                }
035                catch (NullPointerException | IllegalArgumentException ex) {
036                        return null;
037                }
038        }
039}