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 com.restfb.Facebook; 026import com.restfb.types.AbstractFacebookType; 027import com.restfb.types.whatsapp.platform.send.*; 028import com.restfb.types.whatsapp.platform.send.Contact; 029import java.util.ArrayList; 030import java.util.List; 031 032public class SendMessage extends AbstractFacebookType { 033 @Facebook 034 private String to; 035 @Facebook 036 private Context context; 037 @Facebook 038 private Text text; 039 @Facebook 040 private Reaction reaction; 041 @Facebook 042 private Video video; 043 @Facebook 044 private Audio audio; 045 @Facebook 046 private Image image; 047 @Facebook 048 private Document document; 049 @Facebook 050 private Sticker sticker; 051 @Facebook 052 private Interactive interactive; 053 @Facebook 054 private Location location; 055 @Facebook 056 private List<Contact> contacts; 057 @Facebook 058 private Type type = Type.text; 059 @Facebook("messaging_product") 060 private final String messagingProduct = "whatsapp"; 061 062 public SendMessage(String to) { 063 setTo(to); 064 } 065 066 public void setReaction(Reaction reaction) { 067 this.reaction = reaction; 068 this.type = Type.reaction; 069 } 070 071 public void setText(Text text) { 072 this.text = text; 073 this.type = Type.text; 074 } 075 076 public void setMedia(Media media) { 077 if (media instanceof Audio) { 078 this.audio = media.as(Audio.class); 079 this.type = Type.audio; 080 } 081 if (media instanceof Video) { 082 this.video = media.as(Video.class); 083 this.type = Type.video; 084 } 085 if (media instanceof Image) { 086 this.image = media.as(Image.class); 087 this.type = Type.image; 088 } 089 if (media instanceof Document) { 090 this.document = media.as(Document.class); 091 this.type = Type.document; 092 } 093 if (media instanceof Sticker) { 094 this.sticker = media.as(Sticker.class); 095 this.type = Type.sticker; 096 } 097 } 098 099 public void setInteractive(Interactive interactive) { 100 this.interactive = interactive; 101 this.type = Type.interactive; 102 } 103 104 public void setLocation(Location location) { 105 this.location = location; 106 this.type = Type.location; 107 } 108 109 public void addContact(Contact contact) { 110 if (contacts == null) { 111 contacts = new ArrayList<>(); 112 } 113 contacts.add(contact); 114 this.type = Type.contacts; 115 } 116 117 118 public enum Type { 119 text, reaction, audio, video, document, sticker, image, interactive, location, contacts; 120 } 121 122 @java.lang.SuppressWarnings("all") 123 public String getTo() { 124 return this.to; 125 } 126 127 @java.lang.SuppressWarnings("all") 128 public void setTo(final String to) { 129 this.to = to; 130 } 131 132 @java.lang.SuppressWarnings("all") 133 public Context getContext() { 134 return this.context; 135 } 136 137 @java.lang.SuppressWarnings("all") 138 public void setContext(final Context context) { 139 this.context = context; 140 } 141 142 @java.lang.SuppressWarnings("all") 143 public Text getText() { 144 return this.text; 145 } 146 147 @java.lang.SuppressWarnings("all") 148 public Reaction getReaction() { 149 return this.reaction; 150 } 151 152 @java.lang.SuppressWarnings("all") 153 public void setType(final Type type) { 154 this.type = type; 155 } 156}