package com.tencent.qcloud.tuikit.tuichat.bean.message.reply;

import com.tencent.imsdk.v2.V2TIMSoundElem;
import com.tencent.qcloud.tuikit.timcommon.bean.CustomSoundV2TIMElem;
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
import com.tencent.qcloud.tuikit.tuichat.bean.message.SoundMessageBean;

public class SoundReplyQuoteBean extends TUIReplyQuoteBean {
    private V2TIMSoundElem soundElem;

    @Override
    public void onProcessReplyQuoteBean(TUIMessageBean messageBean) {
        if (messageBean instanceof SoundMessageBean) {
            if (messageBean.getV2TIMMessage().getSoundElem() != null) {
                soundElem = messageBean.getV2TIMMessage().getSoundElem();
            }
        }
        if (messageBean.getCusElem() != null && messageBean.getCusElem() instanceof CustomSoundV2TIMElem) {
            soundElem = (V2TIMSoundElem) messageBean.getCusElem();
        }
    }

    public int getDuring() {
        if (soundElem != null) {
            return soundElem.getDuration();
        }
        return 0;
    }
}
