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.JsonIgnoreProperties;
020import com.fasterxml.jackson.annotation.JsonProperty;
021
022@JsonIgnoreProperties(ignoreUnknown = true)
023public class CarrierDetails {
024    private String networkCode;
025    private String name;
026    private String country;
027    private NetworkType networkType;
028
029    @JsonProperty("network_code")
030    public String getNetworkCode() {
031        return networkCode;
032    }
033
034    public String getName() {
035        return name;
036    }
037
038    public String getCountry() {
039        return country;
040    }
041
042    @JsonProperty("network_type")
043    public NetworkType getNetworkType() {
044        return networkType;
045    }
046
047    public enum NetworkType {
048        MOBILE,
049        LANDLINE,
050        LANDLINE_PREMIUM,
051        LANDLINE_TOLLFREE,
052        VIRTUAL,
053        UNKNOWN,
054        PAGER;
055
056        @JsonCreator
057        public static NetworkType fromString(String name) {
058            return NetworkType.valueOf(name.toUpperCase());
059        }
060    }
061}