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 018 019import com.fasterxml.jackson.annotation.JsonInclude; 020import com.fasterxml.jackson.annotation.JsonProperty; 021import com.fasterxml.jackson.annotation.JsonValue; 022import com.vonage.client.voice.ncco.Ncco; 023 024@JsonInclude(value = JsonInclude.Include.NON_EMPTY) 025public class TransferDestination { 026 private Type type; 027 private String[] urls; 028 private Ncco ncco; 029 030 public TransferDestination(Type type, String url) { 031 this.type = type; 032 if (url != null) { 033 this.urls = new String[]{url}; 034 } 035 } 036 037 public TransferDestination(Type type, String url, Ncco ncco) { 038 this(type, url); 039 this.ncco = ncco; 040 } 041 042 @JsonProperty("type") 043 public Type getType() { 044 return type; 045 } 046 047 @JsonProperty("url") 048 public String[] getUrls() { 049 return urls; 050 } 051 052 @JsonProperty("ncco") 053 public Ncco getNcco() { 054 return this.ncco; 055 } 056 057 enum Type { 058 NCCO; 059 060 @JsonValue 061 @Override 062 public String toString() { 063 return name().toLowerCase(); 064 } 065 } 066}