/*
 * Copyright (c) 2020 WildFireChat. All rights reserved.
 */

package cn.wildfirechat.message;

import static cn.wildfirechat.message.core.MessageContentType.ContentType_Screen_Notification;

import android.annotation.SuppressLint;
import android.os.Parcel;
import cn.wildfirechat.message.core.ContentTag;
import cn.wildfirechat.message.core.MessagePayload;
import cn.wildfirechat.message.core.PersistFlag;

/**
 * Created by heavyrainlee on 20/12/2017.
 * 截屏通知
 */


@SuppressLint("ParcelCreator")
@ContentTag(type = ContentType_Screen_Notification, flag = PersistFlag.Persist)
public class ScreenHotNotificationMessageContent extends MessageContent {

    private String content;


    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public MessagePayload encode() {
        MessagePayload payload = super.encode();
        payload.content = content;
        return payload;
    }


    @Override
    public void decode(MessagePayload payload) {
        content = payload.pushContent;
    }

    @Override
    public String digest(Message message) {
        return content;
    }

    public ScreenHotNotificationMessageContent() {
    }


    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.content);
    }

    public void readFromParcel(Parcel source) {
        this.content = source.readString();
    }

    protected ScreenHotNotificationMessageContent(Parcel in) {
        super(in);
        this.content = in.readString();
    }

    public static final Creator<ScreenHotNotificationMessageContent> CREATOR = new Creator<ScreenHotNotificationMessageContent>() {
        @Override
        public ScreenHotNotificationMessageContent createFromParcel(Parcel source) {
            return new ScreenHotNotificationMessageContent(source);
        }

        @Override
        public ScreenHotNotificationMessageContent[] newArray(int size) {
            return new ScreenHotNotificationMessageContent[size];
        }
    };

}
