001// Generated by delombok at Sun Apr 14 14:59:49 CEST 2024
002/*
003 * Copyright (c) 2010-2024 Mark Allen, Norbert Bartels.
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023package com.restfb.types.whatsapp.platform;
024
025import java.util.ArrayList;
026import java.util.Date;
027import java.util.List;
028import com.restfb.Facebook;
029import com.restfb.types.AbstractFacebookType;
030import com.restfb.types.whatsapp.platform.message.*;
031import com.restfb.types.whatsapp.platform.message.Error;
032import com.restfb.types.whatsapp.platform.message.System;
033
034/**
035 * https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
036 */
037public class Message extends AbstractFacebookType {
038  @Facebook
039  private Audio audio;
040  @Facebook
041  private Button button;
042  @Facebook
043  private Context context;
044  @Facebook
045  private Document document;
046  @Facebook
047  private List<Error> errors = new ArrayList<>();
048  @Facebook
049  private String from;
050  @Facebook
051  private String id;
052  @Facebook
053  private Identity identity;
054  @Facebook
055  private Image image;
056  @Facebook
057  private Interactive interactive;
058  @Facebook
059  private Location location;
060  @Facebook
061  private Referral referral;
062  @Facebook
063  private System system;
064  @Facebook
065  private Sticker sticker;
066  @Facebook
067  private Text text;
068  @Facebook
069  private Date timestamp;
070  @Facebook
071  private MessageType type;
072  @Facebook
073  private Video video;
074  @Facebook
075  private Reaction reaction;
076  @Facebook
077  private List<MessageContact> contacts = new ArrayList<>();
078  /**
079   * An arbitrary 256B string, useful for tracking (optional).
080   *
081   * Cloud API only
082   */
083  @Facebook("biz_opaque_callback_data")
084  private String bizOpaqueCallbackData;
085
086  public boolean isText() {
087    return text != null;
088  }
089
090  public boolean isImage() {
091    return image != null;
092  }
093
094  public boolean isVideo() {
095    return video != null;
096  }
097
098  public boolean isSticker() {
099    return sticker != null;
100  }
101
102  public boolean isLocation() {
103    return location != null;
104  }
105
106  public boolean isAudio() {
107    return audio != null;
108  }
109
110  public boolean isVoice() {
111    return isAudio() && getAudio().isVoice();
112  }
113
114  public boolean isButton() {
115    return button != null;
116  }
117
118  public boolean isDocument() {
119    return document != null;
120  }
121
122  public boolean hasReferral() {
123    return referral != null;
124  }
125
126  public boolean hasContext() {
127    return context != null;
128  }
129
130  public boolean isSystem() {
131    return system != null;
132  }
133
134  public boolean isInteractive() {
135    return interactive != null;
136  }
137
138  public boolean isReaction() {
139    return reaction != null;
140  }
141
142  public boolean hasContacts() {
143    return !contacts.isEmpty();
144  }
145
146  public boolean hasErrors() {
147    return !errors.isEmpty();
148  }
149
150  public boolean hasIdentity() {
151    return identity != null;
152  }
153
154  @java.lang.SuppressWarnings("all")
155  public Audio getAudio() {
156    return this.audio;
157  }
158
159  @java.lang.SuppressWarnings("all")
160  public void setAudio(final Audio audio) {
161    this.audio = audio;
162  }
163
164  @java.lang.SuppressWarnings("all")
165  public Button getButton() {
166    return this.button;
167  }
168
169  @java.lang.SuppressWarnings("all")
170  public void setButton(final Button button) {
171    this.button = button;
172  }
173
174  @java.lang.SuppressWarnings("all")
175  public Context getContext() {
176    return this.context;
177  }
178
179  @java.lang.SuppressWarnings("all")
180  public void setContext(final Context context) {
181    this.context = context;
182  }
183
184  @java.lang.SuppressWarnings("all")
185  public Document getDocument() {
186    return this.document;
187  }
188
189  @java.lang.SuppressWarnings("all")
190  public void setDocument(final Document document) {
191    this.document = document;
192  }
193
194  @java.lang.SuppressWarnings("all")
195  public List<Error> getErrors() {
196    return this.errors;
197  }
198
199  @java.lang.SuppressWarnings("all")
200  public void setErrors(final List<Error> errors) {
201    this.errors = errors;
202  }
203
204  @java.lang.SuppressWarnings("all")
205  public String getFrom() {
206    return this.from;
207  }
208
209  @java.lang.SuppressWarnings("all")
210  public void setFrom(final String from) {
211    this.from = from;
212  }
213
214  @java.lang.SuppressWarnings("all")
215  public String getId() {
216    return this.id;
217  }
218
219  @java.lang.SuppressWarnings("all")
220  public void setId(final String id) {
221    this.id = id;
222  }
223
224  @java.lang.SuppressWarnings("all")
225  public Identity getIdentity() {
226    return this.identity;
227  }
228
229  @java.lang.SuppressWarnings("all")
230  public void setIdentity(final Identity identity) {
231    this.identity = identity;
232  }
233
234  @java.lang.SuppressWarnings("all")
235  public Image getImage() {
236    return this.image;
237  }
238
239  @java.lang.SuppressWarnings("all")
240  public void setImage(final Image image) {
241    this.image = image;
242  }
243
244  @java.lang.SuppressWarnings("all")
245  public Interactive getInteractive() {
246    return this.interactive;
247  }
248
249  @java.lang.SuppressWarnings("all")
250  public void setInteractive(final Interactive interactive) {
251    this.interactive = interactive;
252  }
253
254  @java.lang.SuppressWarnings("all")
255  public Location getLocation() {
256    return this.location;
257  }
258
259  @java.lang.SuppressWarnings("all")
260  public void setLocation(final Location location) {
261    this.location = location;
262  }
263
264  @java.lang.SuppressWarnings("all")
265  public Referral getReferral() {
266    return this.referral;
267  }
268
269  @java.lang.SuppressWarnings("all")
270  public void setReferral(final Referral referral) {
271    this.referral = referral;
272  }
273
274  @java.lang.SuppressWarnings("all")
275  public System getSystem() {
276    return this.system;
277  }
278
279  @java.lang.SuppressWarnings("all")
280  public void setSystem(final System system) {
281    this.system = system;
282  }
283
284  @java.lang.SuppressWarnings("all")
285  public Sticker getSticker() {
286    return this.sticker;
287  }
288
289  @java.lang.SuppressWarnings("all")
290  public void setSticker(final Sticker sticker) {
291    this.sticker = sticker;
292  }
293
294  @java.lang.SuppressWarnings("all")
295  public Text getText() {
296    return this.text;
297  }
298
299  @java.lang.SuppressWarnings("all")
300  public void setText(final Text text) {
301    this.text = text;
302  }
303
304  @java.lang.SuppressWarnings("all")
305  public Date getTimestamp() {
306    return this.timestamp;
307  }
308
309  @java.lang.SuppressWarnings("all")
310  public void setTimestamp(final Date timestamp) {
311    this.timestamp = timestamp;
312  }
313
314  @java.lang.SuppressWarnings("all")
315  public MessageType getType() {
316    return this.type;
317  }
318
319  @java.lang.SuppressWarnings("all")
320  public void setType(final MessageType type) {
321    this.type = type;
322  }
323
324  @java.lang.SuppressWarnings("all")
325  public Video getVideo() {
326    return this.video;
327  }
328
329  @java.lang.SuppressWarnings("all")
330  public void setVideo(final Video video) {
331    this.video = video;
332  }
333
334  @java.lang.SuppressWarnings("all")
335  public Reaction getReaction() {
336    return this.reaction;
337  }
338
339  @java.lang.SuppressWarnings("all")
340  public void setReaction(final Reaction reaction) {
341    this.reaction = reaction;
342  }
343
344  @java.lang.SuppressWarnings("all")
345  public List<MessageContact> getContacts() {
346    return this.contacts;
347  }
348
349  @java.lang.SuppressWarnings("all")
350  public void setContacts(final List<MessageContact> contacts) {
351    this.contacts = contacts;
352  }
353
354  /**
355   * An arbitrary 256B string, useful for tracking (optional).
356   *
357   * Cloud API only
358   */
359  @java.lang.SuppressWarnings("all")
360  public String getBizOpaqueCallbackData() {
361    return this.bizOpaqueCallbackData;
362  }
363
364  /**
365   * An arbitrary 256B string, useful for tracking (optional).
366   *
367   * Cloud API only
368   */
369  @java.lang.SuppressWarnings("all")
370  public void setBizOpaqueCallbackData(final String bizOpaqueCallbackData) {
371    this.bizOpaqueCallbackData = bizOpaqueCallbackData;
372  }
373}