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.proactiveconnect;
017
018import com.fasterxml.jackson.annotation.JsonCreator;
019import com.fasterxml.jackson.annotation.JsonValue;
020
021/**
022 * Represents values for {@link Event#getType()}.
023 */
024public enum EventType {
025        /**
026         * Action call succeeded
027         */
028        ACTION_CALL_SUCCEEDED,
029
030        /**
031         * Action call failed
032         */
033        ACTION_CALL_FAILED,
034
035        /**
036         * Action call info
037         */
038        ACTION_CALL_INFO,
039
040        /**
041         * Recipient response
042         */
043        RECIPIENT_RESPONSE,
044
045        /**
046         * Run item skipped
047         */
048        RUN_ITEM_SKIPPED,
049
050        /**
051         * Run item failed
052         */
053        RUN_ITEM_FAILED,
054
055        /**
056         * Run item submitted
057         */
058        RUN_ITEM_SUBMITTED,
059
060        /**
061         * Run items total
062         */
063        RUN_ITEMS_TOTAL,
064
065        /**
066         * Run items ready
067         */
068        RUN_ITEMS_READY,
069
070        /**
071         * Run items excluded
072         */
073        RUN_ITEMS_EXCLUDED;
074
075        @JsonCreator
076        public static EventType fromString(String value) {
077                try {
078                        return valueOf(value.toUpperCase().replace('-', '_'));
079                }
080                catch (NullPointerException | IllegalArgumentException ex) {
081                        return null;
082                }
083        }
084
085        @JsonValue
086        @Override
087        public String toString() {
088                return name().toLowerCase().replace('_', '-');
089        }       
090}