001/*
002 *   Copyright 2020 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.voice;
017
018import com.fasterxml.jackson.annotation.JsonCreator;
019import com.fasterxml.jackson.annotation.JsonValue;
020
021import java.util.HashMap;
022import java.util.Map;
023
024/**
025 * Voice used to deliver text to a {@link Call} in a {@link TalkRequest}.
026 */
027
028public enum VoiceName {
029    ADITI("Aditi"),
030    AGNIESZKA("Agnieszka"),
031    ALVA("Alva"),
032    AMY("Amy"),
033    ASTRID("Astrid"),
034    BIANCA("Bianca"),
035    BRIAN("Brian"),
036    CARLA("Carla"),
037    CARMEN("Carmen"),
038    CARMIT("Carmit"),
039    CATARINA("Catarina"),
040    CELINE("Celine"),
041    CEM("Cem"),
042    CHANTAL("Chantal"),
043    CHIPMUNK("Chipmunk"),
044    CONCHITA("Conchita"),
045    CRISTIANO("Cristiano"),
046    DAMAYANTI("Damayanti"),
047    EMPAR("Empar"),
048    DORA("Dora"),
049    EMMA("Emma"),
050    ENRIQUE("Enrique"),
051    ERIC("Eric"),
052    EWA("Ewa"),
053    FELIPE("Felipe"),
054    FILIZ("Filiz"),
055    GERAINT("Geraint"),
056    GIORGIO("Giorgio"),
057    GWYNETH("Gwyneth"),
058    HANS("Hans"),
059    HENRIK("Henrik"),
060    INES("Ines"),
061    IOANA("Ioana"),
062    IVETA("Iveta"),
063    IVY("Ivy"),
064    JACEK("Jacek"),
065    JAN("Jan"),
066    JENNIFER("Jennifer"),
067    JOANA("Joana"),
068    JOEY("Joey"),
069    JORDI("Jordi"),
070    JUSTIN("Justin"),
071    KANYA("Kanya"),
072    KARL("Karl"),
073    KENDRA("Kendra"),
074    KIMBERLY("Kimberly"),
075    LAILA("Laila"),
076    LAURA("Laura"),
077    LEA("Lea"),
078    LEKHA("Lekha"),
079    LIV("Liv"),
080    LOTTE("Lotte"),
081    LUCIA("Lucia"),
082    LUCIANA("Luciana"),
083    MADS("Mads"),
084    MAGED("Maged"),
085    MAJA("Maja"),
086    MARISKA("Mariska"),
087    MARLENE("Marlene"),
088    MATHIEU("Mathieu"),
089    MATTHEW("Matthew"),
090    MAXIM("Maxim"),
091    MEI_JIA("Mei-Jia"),
092    MELINA("Melina"),
093    MIA("Mia"),
094    MIGUEL("Miguel"),
095    MIREN("Miren"),
096    MIZUKI("Mizuki"),
097    MONTSERRAT("Montserrat"),
098    NAJA("Naja"),
099    NICOLE("Nicole"),
100    NIKOS("Nikos"),
101    NORA("Nora"),
102    OSKAR("Oskar"),
103    PENELOPE("Penelope"),
104    RAVEENA("Raveena"),
105    RICARDO("Ricardo"),
106    RUBEN("Ruben"),
107    RUSSELL("Russell"),
108    SALLI("Salli"),
109    SATU("Satu"),
110    SEOYEON("Seoyeon"),
111    SIN_JI("Sin-Ji"),
112    SORA("Sora"),
113    TAKUMI("Takumi"),
114    TARIK("Tarik"),
115    TATYANA("Tatyana"),
116    TESSA("Tessa"),
117    TIAN_TIAN("Tian-Tian"),
118    VICKI("Vicki"),
119    VITORIA("Vitoria"),
120    YELDA("Yelda"),
121    ZEINA("Zeina"),
122    ZHIYU("Zhiyu"),
123    ZUZANA("Zuzana"),
124    UNKNOWN("Unknown");
125
126    private static final Map<String, VoiceName> voiceNameIndex = new HashMap<>();
127
128    static {
129        for (VoiceName voiceName : VoiceName.values()) {
130            voiceNameIndex.put(voiceName.name(), voiceName);
131        }
132    }
133
134    private String displayName;
135
136    VoiceName(String displayName) {
137        this.displayName = displayName;
138    }
139
140    @Override
141    public String toString() {
142        return displayName;
143    }
144
145    @JsonCreator
146    public static VoiceName fromString(String name) {
147        VoiceName foundVoiceName = voiceNameIndex.get(name.toUpperCase());
148        return (foundVoiceName != null) ? foundVoiceName : UNKNOWN;
149    }
150
151    @JsonValue
152    public String getDisplayName() {
153        return displayName;
154    }
155}