package com.ssyf.module.robot.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author ELSA
 * @description 机器人运行信息视图对象
 */
@Data
@Accessors(chain = true)
public class RRobotRunningInfoVo implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;
    private String robotGroupUuid;

    private String robotGroupName;
    /**
     * 运行信息唯一标识（UUID）
     */
    private String uuid;

    /**
     * 关联机器人UUID
     */
    private String robotUuid;

    /**
     * 关联机器人登录账号
     */
    private String robotAccount;
    /**
     * 机器人昵称
     */
    private String robotNickName;


    /**
     * 运行状态：1-在线，2-离线，3-异常
     */
    private Integer runningStatus;

    private String runningStatusStr;

    /**
     * 当前行为：1-闲逛，2-在直播间，3-送礼物，4-聊天
     */
    private Integer currentBehavior;

    private String currentBehaviorStr;

    /**
     * 当前所在直播间ID
     */
    private String liveRoomId;

    /**
     * 当前直播间主播ID
     */
    private String anchorId;
    /**
     * 直播间名称
     */
    private String liveRoomName;

    /**
     * 主播名称
     */
    private String anchorName;

    /**
     * 主播头像
     */
    private String anchorAvatar;

    /**
     * 机器人登录时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime loginTime;

    /**
     * 机器人退出时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime logoutTime;

    /**
     * 最后更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime lastUpdateTime;

    /**
     * 进入直播间时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime enterLiveRoomTime;

    /**
     * 退出直播间时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime exitLiveRoomTime;


    public void setRunningStatusStr() {
        if (this.runningStatus != null) {
            switch (this.runningStatus) {
                case 1:
                    this.runningStatusStr = "在线";
                    break;
                case 2:
                    this.runningStatusStr = "离线";
                    break;
                case 3:
                    this.runningStatusStr = "异常";
                    break;
                default:
                    this.runningStatusStr = "未知";
                    break;
            }
        } else {
            this.runningStatusStr = "未知";
        }
    }

    public void setCurrentBehaviorStr() {
        if (this.currentBehavior != null) {
            switch (this.currentBehavior) {
                case 1:
                    this.currentBehaviorStr = "闲逛";
                    break;
                case 2:
                    this.currentBehaviorStr = "在直播间";
                    break;
                case 3:
                    this.currentBehaviorStr = "送礼物";
                    break;
                case 4:
                    this.currentBehaviorStr = "聊天";
                    break;
                case 5:
                    this.currentBehaviorStr = "离线";
                    break;
                default:
                    this.currentBehaviorStr = "未知";
                    break;
            }
        } else {
            this.currentBehaviorStr = "未知";
        }
    }
}