package com.platform.modules.foreign.entity;/**
 * Created by TROY on 2019/2/22.
 */

import com.platform.common.utils.DateUtils;
import com.platform.modules.live.entity.LiveSceneEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.util.HtmlUtils;

import java.util.Date;
import java.util.List;

/**
 * @author TROY
 * @version V1.0
 * @ClassName: SceneForeignEntity
 * @Description: TODO
 * @date 2019/2/22 11:29
 */
public class SceneForeignEntity {

	private String id;
	private String title;
	private String sceneType;
	private String titleImage;
	private String videoUrl;
	private String liveDesc;
	private String liveDescHref;
	private String liveStart;
	private String livePosition;
	private String sceneState;
	private String allowComment;
	private List<SceneStreamForeignEntity> liveList;
	private String caster;
	// 评论总数
	private String comments;

	public SceneForeignEntity() {

	}

	public SceneForeignEntity(LiveSceneEntity entity) {
		if (null == entity || null == entity.getId()) {
			return;
		}
		this.id = entity.getId()==null ? "" : String.valueOf(entity.getId());
		this.title = entity.getTitle();
		this.sceneType = entity.getSceneType()==null ? "" : String.valueOf(entity.getSceneType());
		this.titleImage = StringUtils.isNotBlank(entity.getTitleImage()) ? entity.getTitleImage() : "";
		this.videoUrl = StringUtils.isNotBlank(entity.getVideoUrl()) ? entity.getVideoUrl() : "";
		this.liveDesc = entity.getLiveDesc();
		if (StringUtils.isNotBlank(entity.getLiveDescHref())) {
			this.liveDescHref = HtmlUtils.htmlUnescape(entity.getLiveDescHref());
		}
		if (null!=entity.getLiveStart()) {
			this.liveStart = DateUtils.format(entity.getLiveStart(), DateUtils.DATE_TIME_PATTERN);
		} else {
			this.liveStart = "";
		}
		this.livePosition = entity.getLivePosition();
		// 现场直播状态
		this.sceneState = null==entity.getLiveState() ? "0" : String.valueOf(entity.getLiveState());
		this.allowComment = null==entity.getAllowComment() ? "1" : String.valueOf(entity.getAllowComment());
		if(entity.getCasterId() != null)
			this.caster = entity.getCasterId().toString();
		else
			this.caster = "";
	}

	public String getId() {
		return id;
	}

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

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSceneType() {
		return sceneType;
	}

	public void setSceneType(String sceneType) {
		this.sceneType = sceneType;
	}

	public String getTitleImage() {
		return titleImage;
	}

	public void setTitleImage(String titleImage) {
		this.titleImage = titleImage;
	}

	public String getVideoUrl() {
		return videoUrl;
	}

	public void setVideoUrl(String videoUrl) {
		this.videoUrl = videoUrl;
	}

	public String getLiveDesc() {
		return liveDesc;
	}

	public void setLiveDesc(String liveDesc) {
		this.liveDesc = liveDesc;
	}

	public String getLiveDescHref() {
		return liveDescHref;
	}

	public void setLiveDescHref(String liveDescHref) {
		this.liveDescHref = liveDescHref;
	}

	public String getLiveStart() {
		return liveStart;
	}

	public void setLiveStart(String liveStart) {
		this.liveStart = liveStart;
	}

	public String getLivePosition() {
		return livePosition;
	}

	public void setLivePosition(String livePosition) {
		this.livePosition = livePosition;
	}

	public String getSceneState() {
		return sceneState;
	}

	public void setSceneState(String sceneState) {
		this.sceneState = sceneState;
	}

	public String getAllowComment() {
		return allowComment;
	}

	public void setAllowComment(String allowComment) {
		this.allowComment = allowComment;
	}

	public List<SceneStreamForeignEntity> getLiveList() {
		return liveList;
	}

	public void setLiveList(List<SceneStreamForeignEntity> liveList) {
		this.liveList = liveList;
	}

	public String getCaster() {
		return caster;
	}

	public void setCaster(String caster) {
		this.caster = caster;
	}

	public String getComments(){return comments;}

	public void setComments(String comments){this.comments = comments;}
}
