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.messages;
017
018import com.fasterxml.jackson.annotation.JsonProperty;
019import com.vonage.client.JsonableBaseObject;
020import java.util.Map;
021
022/**
023 * Used for inbound Button messages.
024 *
025 * @since 8.11.0
026 */
027public final class Button extends JsonableBaseObject {
028        private Object payload;
029        private String text, subtype;
030
031        Button() {}
032
033        /**
034         * Payload for the button. Contents can be varied depending on the type of button.
035         * For WhatsApp messages, this will be a Map. For RCS, this will be a String.
036         *
037         * @return The button payload, or {@code null} if absent.
038         */
039        @JsonProperty("payload")
040        public Object getPayload() {
041                return payload;
042        }
043
044        /**
045         * Additional context for the button.
046         *
047         * @return The button text, or {@code null} if absent.
048         */
049        @JsonProperty("text")
050        public String getText() {
051                return text;
052        }
053
054        /**
055         * Subtype of button being received. This only applies to WhatsApp messages.
056         *
057         * @return The button subtype, or {@code null} if absent / not applicable.
058         */
059        @JsonProperty("subtype")
060        public String getSubtype() {
061                return subtype;
062        }
063}