001/*
002 * Copyright (c) 2011-2017 Nexmo Inc
003 *
004 * Permission is hereby granted, free of charge, to any person obtaining a copy
005 * of this software and associated documentation files (the "Software"), to deal
006 * in the Software without restriction, including without limitation the rights
007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008 * copies of the Software, and to permit persons to whom the Software is
009 * furnished to do so, subject to the following conditions:
010 *
011 * The above copyright notice and this permission notice shall be included in
012 * all copies or substantial portions of the Software.
013 *
014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
020 * THE SOFTWARE.
021 */
022package com.nexmo.client.voice.ncco;
023
024import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
025import com.fasterxml.jackson.annotation.JsonInclude;
026import com.fasterxml.jackson.annotation.JsonProperty;
027
028@JsonInclude(value = JsonInclude.Include.NON_NULL)
029@JsonIgnoreProperties(ignoreUnknown = true)
030public class RecordNcco implements Ncco {
031    private static final String ACTION = "record";
032
033    private RecordingFormat format = null;
034    private Integer endOnSilence = null;
035    private Character endOnKey = null;
036    private Integer timeout = null;
037    private Boolean beepStart = null;
038    private String[] eventUrl = null;
039    private String eventMethod = null;
040
041    public RecordingFormat getFormat() {
042        return format;
043    }
044
045    public void setFormat(RecordingFormat format) {
046        this.format = format;
047    }
048
049    public Integer getEndOnSilence() {
050        return endOnSilence;
051    }
052
053    public void setEndOnSilence(Integer endOnSilence) {
054        this.endOnSilence = endOnSilence;
055    }
056
057    public Character getEndOnKey() {
058        return endOnKey;
059    }
060
061    public void setEndOnKey(Character endOnKey) {
062        this.endOnKey = endOnKey;
063    }
064
065    public Integer getTimeout() {
066        return timeout;
067    }
068
069    public void setTimeout(Integer timeout) {
070        this.timeout = timeout;
071    }
072
073    public Boolean getBeepStart() {
074        return beepStart;
075    }
076
077    public void setBeepStart(Boolean beepStart) {
078        this.beepStart = beepStart;
079    }
080
081    public String[] getEventUrl() {
082        return eventUrl;
083    }
084
085    public void setEventUrl(String eventUrl) {
086        setEventUrl(new String[]{eventUrl});
087    }
088
089    @JsonProperty("eventUrl")
090    public void setEventUrl(String[] eventUrl) {
091        this.eventUrl = eventUrl;
092    }
093
094    public String getEventMethod() {
095        return eventMethod;
096    }
097
098    public void setEventMethod(String eventMethod) {
099        this.eventMethod = eventMethod;
100    }
101
102    @Override
103    public String getAction() {
104        return ACTION;
105    }
106
107    @Override
108    public String toJson() {
109        return NccoSerializer.getInstance().serializeNcco(this);
110    }
111}