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;
020import java.util.Arrays;
021import java.util.Map;
022import java.util.function.Function;
023import java.util.stream.Collectors;
024
025/**
026 * Represents the available layout types for archives in {@link StreamCompositionLayout}.
027 */
028public enum ScreenLayoutType {
029        /**
030         * Best fit
031         */
032        BEST_FIT("bestFit"),
033
034        /**
035         * Custom (uses stylesheet)
036         */
037        CUSTOM("custom"),
038
039        /**
040         * Horizontal presentation
041         */
042        HORIZONTAL("horizontalPresentation"),
043
044        /**
045         * Vertical presentation
046         */
047        VERTICAL("verticalPresentation"),
048
049        /**
050         * Picture-in-picture
051         */
052        PIP("pip");
053
054        private static final Map<String, ScreenLayoutType> TYPE_INDEX =
055                Arrays.stream(ScreenLayoutType.values()).collect(Collectors.toMap(
056                                ScreenLayoutType::toString, Function.identity()
057                ));
058
059        private final String value;
060
061        ScreenLayoutType(String value) {
062                this.value = value;
063        }
064
065        @JsonCreator
066        public static ScreenLayoutType fromString(String value) {
067                return TYPE_INDEX.getOrDefault(value, null);
068        }
069
070        @JsonValue
071        @Override
072        public String toString() {
073                return value;
074        }       
075}