001/*
002 *   Copyright 2024 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.JsonProperty;
019import com.vonage.client.Jsonable;
020import com.vonage.client.JsonableBaseObject;
021
022/**
023 * Represents metadata about a call.
024 */
025public class CallEvent extends JsonableBaseObject {
026    private String uuid, conversationUuid;
027    private CallStatus status;
028    private CallDirection direction;
029
030    /**
031     * The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage.
032     * You use the UUID in all requests for individual live calls.
033     *
034     * @return The call ID.
035     */
036    @JsonProperty("uuid")
037    public String getUuid() {
038        return uuid;
039    }
040
041    /**
042     * The unique identifier for the conversation this call leg is part of.
043     *
044     * @return The conversation ID as a string.
045     */
046    @JsonProperty("conversation_uuid")
047    public String getConversationUuid() {
048        return conversationUuid;
049    }
050
051    /**
052     * The status of the call.
053     *
054     * @return The call's status as an enum.
055     */
056    @JsonProperty("status")
057    public CallStatus getStatus() {
058        return status;
059    }
060
061    /**
062     * Whether the call is inbound or outbound.
063     *
064     * @return The call direction as an enum.
065     */
066    @JsonProperty("direction")
067    public CallDirection getDirection() {
068        return direction;
069    }
070
071    /**
072     * Creates an instance of this class from a JSON payload.
073     *
074     * @param json The JSON string to parse.
075     *
076     * @return An instance of this class with the fields populated, if present.
077     * @deprecated Use {@link Jsonable#fromJson(String, Class)}.
078     */
079    @Deprecated
080    public static CallEvent fromJson(String json) {
081        return Jsonable.fromJson(json);
082    }
083}