net.optionfactory.whatsapp.dto.messages.Section Maven / Gradle / Ivy
package net.optionfactory.whatsapp.dto.messages;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Required for List Messages and Multi-Product Messages
*
*
* - products: Required for Multi-Product Messages - Array of product objects. There is a minimum of 1 product per section and a maximum of 30 products across all sections
* - rows: Required for List Messages - Contains a list of rows. You can have a total of 10 rows across your sections.
- Each row must have a:
*
* - title: Required - Maximum length: 24 characters
* - ID: Required - Maximum length: 200 characters
* - description: Optional - Maximum length: 72 characters
*
* - title: Required if the message has more than one section - Title of the section
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Section {
/**
* The Title.
*/
@JsonProperty("title")
public String title;
/**
* The Products.
*/
@JsonProperty("product_items")
public List products;
/**
* The Rows.
*/
@JsonProperty("rows")
public List rows;
/**
* Gets title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Sets title.
*
* @param title the title
* @return the title
*/
public Section setTitle(String title) {
this.title = title;
return this;
}
/**
* Gets product items.
*
* @return the product items
*/
public List getProducts() {
return products;
}
/**
* Sets product items.
*
* @param products the products
* @return the product items
*/
public Section setProducts(List products) {
this.products = products;
return this;
}
/**
* Add product item section.
*
* @param product the product
* @return the section
*/
public Section addProductItem(Product product) {
if (this.products == null)
this.products = new ArrayList<>();
this.products.add(product);
return this;
}
/**
* Gets rows.
*
* @return the rows
*/
public List getRows() {
return rows;
}
/**
* Sets rows.
*
* @param rows the rows
* @return the rows
*/
public Section setRows(List rows) {
this.rows = rows;
return this;
}
/**
* Add row section.
*
* @param row the row
* @return the section
*/
public Section addRow(Row row) {
if (this.rows == null)
this.rows = new ArrayList<>();
this.rows.add(row);
return this;
}
}