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.send.interactive;
024
025import com.restfb.Facebook;
026import com.restfb.types.AbstractFacebookType;
027import java.util.ArrayList;
028import java.util.List;
029
030public class Action extends AbstractFacebookType {
031  @Facebook
032  private String button;
033  @Facebook
034  private List<Button> buttons;
035  @Facebook("catalog_id")
036  private String catalogId;
037  @Facebook("product_retailer_id")
038  private String productRetailerId;
039  @Facebook
040  private List<Section> sections;
041
042  public Action addButton(Button button) {
043    if (buttons == null) {
044      buttons = new ArrayList<>();
045    }
046    if (buttons.size() <= 3) {
047      buttons.add(button);
048    } else {
049      throw new IllegalArgumentException("Action may contain only up to 3 buttons");
050    }
051    return this;
052  }
053
054  public Action addSection(Section section) {
055    if (sections == null) {
056      sections = new ArrayList<>();
057    }
058    sections.add(section);
059    return this;
060  }
061
062  @java.lang.SuppressWarnings("all")
063  public String getButton() {
064    return this.button;
065  }
066
067  @java.lang.SuppressWarnings("all")
068  public void setButton(final String button) {
069    this.button = button;
070  }
071
072  @java.lang.SuppressWarnings("all")
073  public List<Button> getButtons() {
074    return this.buttons;
075  }
076
077  @java.lang.SuppressWarnings("all")
078  public String getCatalogId() {
079    return this.catalogId;
080  }
081
082  @java.lang.SuppressWarnings("all")
083  public void setCatalogId(final String catalogId) {
084    this.catalogId = catalogId;
085  }
086
087  @java.lang.SuppressWarnings("all")
088  public String getProductRetailerId() {
089    return this.productRetailerId;
090  }
091
092  @java.lang.SuppressWarnings("all")
093  public void setProductRetailerId(final String productRetailerId) {
094    this.productRetailerId = productRetailerId;
095  }
096}