package com.daya.live_teaching.model;

import android.text.TextUtils;

import com.cooleshow.base.utils.DateUtil;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.List;

public class ClassMember implements Serializable {
    private boolean cameraFlag;
    public String courseScheduleId;
    public String id;
    private String joinTime;

    public boolean isMicrophone() {
        return micFlag;
    }

    public void setMicrophone(boolean micFlag) {
        this.micFlag = micFlag;
    }

    private boolean micFlag;//是否开启麦克风
    private int role;
    private String userId;
    private String avatar;
    private String username;

    public boolean isMusicMode() {
        return musicModeFlag;
    }

    public void setMusicMode(boolean musicModeFlag) {
        this.musicModeFlag = musicModeFlag;
    }

    private boolean musicModeFlag;//音乐模式是否开启

    public boolean isHandUpOn() {
        return handFlag;
    }

    public void setHandUpOn(boolean handFlag) {
        this.handFlag = handFlag;
    }

    private boolean handFlag;//是否举手
    private boolean isVisibiliyMic;//是否显示麦克风按钮
    private boolean isOnStage;//是否上台

    private PlayMidiJsonBean playMidiJson;
    private List<ScheduleStudentMusicScoresBean> scheduleStudentMusicScores;


    public String getHeadUrl() {
        return avatar;
    }

    public void setHeadUrl(String headUrl) {
        this.avatar = headUrl;
    }


    public boolean isOnStage() {
        return isOnStage;
    }

    public void setOnStage(boolean onStage) {
        isOnStage = onStage;
    }

    public boolean isVisibiliyMic() {
        return isVisibiliyMic;
    }

    public void setVisibiliyMic(boolean visibiliyMic) {
        isVisibiliyMic = visibiliyMic;
    }


    public long getJoinTime() {
        try {
            long time = DateUtil.parseDatetime(joinTime).getTime();
            return time;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    public void setJoinTime(long joinTime) {
        try {
            this.joinTime = DateUtil.getMillon(joinTime);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public void setJoinTime(String joinTime) {
        this.joinTime = joinTime;
    }

    public Role getRole() {
        return Role.createRole(role);
    }

    public void setRole(int role) {
        this.role = role;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return username;
    }

    public void setUserName(String userName) {
        this.username = userName;
    }

    public PlayMidiJsonBean getPlayMidiJson() {
        return playMidiJson;
    }

    public void setPlayMidiJson(PlayMidiJsonBean playMidiJson) {
        this.playMidiJson = playMidiJson;
    }

    public boolean isCamera() {
        return cameraFlag;
    }

    public void setCamera(boolean cameraFlag) {
        this.cameraFlag = cameraFlag;
    }

    public static class PlayMidiJsonBean implements Serializable {

        /**
         * customType : 0
         * enable : true
         * playVolume : 0
         * rate : 0
         * roomId : 0
         * type :
         * userId :
         */

        public int customType;
        public boolean enable;

        public int getPlayVolume() {
            return playVolume;
        }

        public void setPlayVolume(int playVolume) {
            this.playVolume = playVolume;
        }

        public int playVolume;
        public int rate;
        public int roomId;
        public String type;
        public String userId;

        public int getRate() {
            return rate;
        }

        public void setRate(int rate) {
            this.rate = rate;
        }

        public boolean isEnable() {
            return enable;
        }

        public void setEnable(boolean enable) {
            this.enable = enable;
        }

        public int getCustomType() {
            return customType;
        }

        public void setCustomType(int customType) {
            this.customType = customType;
        }
    }


    public List<ScheduleStudentMusicScoresBean> getScheduleStudentMusicScores() {
        return scheduleStudentMusicScores;
    }

    public void setScheduleStudentMusicScores(List<ScheduleStudentMusicScoresBean> scheduleStudentMusicScores) {
        this.scheduleStudentMusicScores = scheduleStudentMusicScores;
    }

    public static class ScheduleStudentMusicScoresBean implements Serializable {
        private int accompanimentPlayStatus;
        private int downStatus;
        private String id;
        private String musicScoreAccompanimentId;
        private int playStatus;
        private int speed;
        private String url;
        private String mp3Url;
        private String musicScoreName;
        private int isAccompaniment;

        public ScheduleStudentMusicScoresBean() {

        }

        public ScheduleStudentMusicScoresBean(int accompanimentPlayStatus, int playStatus) {
            this.accompanimentPlayStatus = accompanimentPlayStatus;
            this.playStatus = playStatus;
        }

        public ScheduleStudentMusicScoresBean(int accompanimentPlayStatus, int downStatus, String musicScoreAccompanimentId, int playStatus, int speed, String url, String mp3Url, String musicScoreName) {
            this.accompanimentPlayStatus = accompanimentPlayStatus;
            this.downStatus = downStatus;
            this.musicScoreAccompanimentId = musicScoreAccompanimentId;
            this.playStatus = playStatus;
            this.speed = speed;
            this.url = url;
            this.mp3Url = mp3Url;
            this.musicScoreName = musicScoreName;
        }

        /**
         * accompanimentPlayStatus : 0
         * downStatus : 0
         * id : 48
         * musicScoreAccompanimentId : 86
         * playStatus : 0
         * speed : 90
         * url :
         * mp3Url :
         */

        public int getIsAccompaniment() {
            return isAccompaniment;
        }

        public void setIsAccompaniment(int isAccompaniment) {
            this.isAccompaniment = isAccompaniment;
        }

        public String getMusicScoreName() {
            return musicScoreName;
        }

        public void setMsicScoreName(String musicScoreName) {
            this.musicScoreName = musicScoreName;
        }

        public int getAccompanimentPlayStatus() {
            return accompanimentPlayStatus;
        }

        public void setAccompanimentPlayStatus(int accompanimentPlayStatus) {
            this.accompanimentPlayStatus = accompanimentPlayStatus;
        }

        public int getDownStatus() {
            return downStatus;
        }

        public void setDownStatus(int downStatus) {
            this.downStatus = downStatus;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getMusicScoreAccompanimentId() {
            return musicScoreAccompanimentId;
        }

        public void setMusicScoreAccompanimentId(String musicScoreAccompanimentId) {
            this.musicScoreAccompanimentId = musicScoreAccompanimentId;
        }

        public int getPlayStatus() {
            return playStatus;
        }

        public void setPlayStatus(int playStatus) {
            this.playStatus = playStatus;
        }

        public int getSpeed() {
            return speed;
        }

        public void setSpeed(int speed) {
            this.speed = speed;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getMp3Url() {
            return mp3Url;
        }

        public String getMp3UrlName() {
            return TextUtils.isEmpty(mp3Url) ? "" : mp3Url.substring(mp3Url.lastIndexOf("/") + 1);
        }

        public String getUrlName() {
            return TextUtils.isEmpty(url) ? "" : url.substring(url.lastIndexOf("/") + 1);
        }

        public void setMp3Url(String mp3Url) {
            this.mp3Url = mp3Url;
        }
    }
}
