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

it.auties.whatsapp.model.chat.ChatDisappear Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonCreator;
import it.auties.protobuf.base.ProtobufMessage;
import it.auties.protobuf.base.ProtobufName;
import it.auties.protobuf.base.ProtobufProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.experimental.Accessors;
import lombok.extern.jackson.Jacksonized;

import java.util.Arrays;

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

/**
 * A model that represents a chat disappear mode
 */
@AllArgsConstructor
@Data
@Builder
@Jacksonized
@Accessors(fluent = true)
@ProtobufName("DisappearingMode")
public class ChatDisappear implements ProtobufMessage {
    @ProtobufProperty(index = 1, type = MESSAGE, implementation = ChatDisappear.Type.class)
    private Type disappear;

    /**
     * The constants of this enumerated type describe the various actors that can initialize
     * disappearing messages in a chat
     */
    @AllArgsConstructor
    @Accessors(fluent = true)
    @ProtobufName("Initiator")
    public enum Type implements ProtobufMessage {
        /**
         * Changed in chat
         */
        CHANGED_IN_CHAT(0),
        /**
         * Initiated by me
         */
        INITIATED_BY_ME(1),
        /**
         * Initiated by other
         */
        INITIATED_BY_OTHER(2);
        
        @Getter
        private final int index;

        @JsonCreator
        public static Type of(int index) {
            return Arrays.stream(values()).filter(entry -> entry.index() == index).findFirst().orElse(null);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy