package com.cooleshow.teacher.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Author by pq, Date on 2022/3/29.
 */
public class LiveRoomInfoBean implements Parcelable {

    /**
     * courseGroupId : 0
     * courseId : 0
     * coverPic :
     * likeNum : 0
     * liveEndTime :
     * liveRemark :
     * liveStartTime :
     * liveState : 0
     * lookNum : 0
     * roomState : 0
     * roomTitle :
     * roomUid :
     * speakerId : 0
     * speakerName :
     * subjectId : 0
     * type :
     */

    public int courseGroupId;
    public int courseId;
    public String coverPic;
    public int likeNum;
    public String liveEndTime;//2022-07-26 10:12:07
    public String liveRemark;
    public String liveStartTime;
    public int liveState;
    public int lookNum;
    public int roomState;
    public String roomTitle;
    public String roomUid;
    public String speakerId;
    public String speakerName;
    public String speakerPic;
    public int expiredCloseMinute;
    public int subjectId;
    public String type;
    public String roomType;

    /**
     * 服务端返回的是分钟,需按毫秒算
     *
     * @return
     */
    public int getExpiredCloseMinute() {
        return expiredCloseMinute * 60 * 1000;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.courseGroupId);
        dest.writeInt(this.courseId);
        dest.writeString(this.coverPic);
        dest.writeInt(this.likeNum);
        dest.writeString(this.liveEndTime);
        dest.writeString(this.liveRemark);
        dest.writeString(this.liveStartTime);
        dest.writeInt(this.liveState);
        dest.writeInt(this.lookNum);
        dest.writeInt(this.roomState);
        dest.writeString(this.roomTitle);
        dest.writeString(this.roomUid);
        dest.writeString(this.speakerId);
        dest.writeString(this.speakerName);
        dest.writeInt(this.subjectId);
        dest.writeString(this.type);
    }

    public void readFromParcel(Parcel source) {
        this.courseGroupId = source.readInt();
        this.courseId = source.readInt();
        this.coverPic = source.readString();
        this.likeNum = source.readInt();
        this.liveEndTime = source.readString();
        this.liveRemark = source.readString();
        this.liveStartTime = source.readString();
        this.liveState = source.readInt();
        this.lookNum = source.readInt();
        this.roomState = source.readInt();
        this.roomTitle = source.readString();
        this.roomUid = source.readString();
        this.speakerId = source.readString();
        this.speakerName = source.readString();
        this.subjectId = source.readInt();
        this.type = source.readString();
    }

    public LiveRoomInfoBean() {
    }

    protected LiveRoomInfoBean(Parcel in) {
        this.courseGroupId = in.readInt();
        this.courseId = in.readInt();
        this.coverPic = in.readString();
        this.likeNum = in.readInt();
        this.liveEndTime = in.readString();
        this.liveRemark = in.readString();
        this.liveStartTime = in.readString();
        this.liveState = in.readInt();
        this.lookNum = in.readInt();
        this.roomState = in.readInt();
        this.roomTitle = in.readString();
        this.roomUid = in.readString();
        this.speakerId = in.readString();
        this.speakerName = in.readString();
        this.subjectId = in.readInt();
        this.type = in.readString();
    }

    public static final Creator<LiveRoomInfoBean> CREATOR = new Creator<LiveRoomInfoBean>() {
        @Override
        public LiveRoomInfoBean createFromParcel(Parcel source) {
            return new LiveRoomInfoBean(source);
        }

        @Override
        public LiveRoomInfoBean[] newArray(int size) {
            return new LiveRoomInfoBean[size];
        }
    };
}
