All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.message.standard.ProductMessage Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
package it.auties.whatsapp.model.message.standard;

import it.auties.protobuf.base.ProtobufProperty;
import it.auties.whatsapp.model.contact.ContactJid;
import it.auties.whatsapp.model.message.model.ButtonMessage;
import it.auties.whatsapp.model.message.model.ContextualMessage;
import it.auties.whatsapp.model.message.model.MessageCategory;
import it.auties.whatsapp.model.message.model.MessageType;
import it.auties.whatsapp.model.product.Product;
import it.auties.whatsapp.model.product.ProductCatalog;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;

import static it.auties.protobuf.base.ProtobufType.MESSAGE;
import static it.auties.protobuf.base.ProtobufType.STRING;

/**
 * A model class that represents a message holding a product inside
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
@Jacksonized
@Accessors(fluent = true)
public final class ProductMessage extends ContextualMessage implements ButtonMessage {
    /**
     * The product that this message wraps
     */
    @ProtobufProperty(index = 1, type = MESSAGE, implementation = Product.class)
    private Product product;

    /**
     * The jid of the WhatsappBusiness account that owns the product that this message wraps
     */
    @ProtobufProperty(index = 2, type = STRING)
    private ContactJid businessOwnerJid;

    /**
     * The catalog where the product that this message wraps is
     */
    @ProtobufProperty(index = 4, type = MESSAGE, implementation = ProductCatalog.class)
    private ProductCatalog catalog;

    /**
     * The body of this message
     */
    @ProtobufProperty(index = 5, type = STRING)
    private String body;

    /**
     * The footer of this message
     */
    @ProtobufProperty(index = 6, type = STRING)
    private String footer;

    @Override
    public MessageType type() {
        return MessageType.PRODUCT;
    }

    @Override
    public MessageCategory category() {
        return MessageCategory.STANDARD;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy