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.insight;
017
018import com.fasterxml.jackson.annotation.JsonCreator;
019import com.fasterxml.jackson.annotation.JsonProperty;
020
021import java.util.HashMap;
022import java.util.Map;
023
024public class RoamingDetails {
025    public enum RoamingStatus {
026        UNKNOWN, ROAMING, NOT_ROAMING;
027
028        private static final Map<String, RoamingStatus> ROAMING_STATUS_INDEX = new HashMap<>();
029
030        static {
031            for (RoamingStatus roamingStatus : RoamingStatus.values()) {
032                ROAMING_STATUS_INDEX.put(roamingStatus.name(), roamingStatus);
033            }
034        }
035
036        @JsonCreator
037        public static RoamingStatus fromString(String name) {
038            RoamingStatus foundRoamingStatus = ROAMING_STATUS_INDEX.get(name.toUpperCase());
039            return (foundRoamingStatus != null) ? foundRoamingStatus : UNKNOWN;
040        }
041    }
042
043    private RoamingStatus status;
044    private String roamingCountryCode;
045    private String roamingNetworkCode;
046    private String roamingNetworkName;
047
048    public RoamingStatus getStatus() {
049        return status;
050    }
051
052    @JsonProperty("roaming_country_code")
053    public String getRoamingCountryCode() {
054        return roamingCountryCode;
055    }
056
057    @JsonProperty("roaming_network_code")
058    public String getRoamingNetworkCode() {
059        return roamingNetworkCode;
060    }
061
062    @JsonProperty("roaming_network_name")
063    public String getRoamingNetworkName() {
064        return roamingNetworkName;
065    }
066}