package com.zd.alg.speaker.domain.vo;

import com.zd.common.core.utils.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Optional;

/**
 * @author 董高升
 * @descript 播放vo
 */
public class PlayVo {

    private static Logger logger = LoggerFactory.getLogger(PlayVo.class);

    @ApiModelProperty(required = true, notes = "设备编号")
    private String sn;
    @ApiModelProperty(required = false, notes = "方便对接时传递任务类型")
    private String type;
    @ApiModelProperty(required = false, notes = "任务名称")
    private String name;
    @ApiModelProperty(required = true, notes = "播放速度")
    private Integer speed;
    @ApiModelProperty(required = false, notes = "播放参数")
    private ParamVo params;
    @ApiModelProperty(required = true, notes = "远程端口")
    private int port;
    @ApiModelProperty(required = true, notes = "设备Ip")
    private String deviceIp;

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        if(StringUtils.isBlank(name)){
            this.type="req";
        }else{
            this.type = type;
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if(StringUtils.isBlank(name)){
            this.name="songs_queue_append";
        }else{
            this.name = name;
        }
    }

    public ParamVo getParams() {
        return params;
    }

    public void setParams(ParamVo params) {
        this.params = params;
    }

    @Override
    public String toString() {
        return "PlayVo{" +
                "sn='" + sn + '\'' +
                ", type='" + type + '\'' +
                ", name='" + name + '\'' +
                ", params=" + params +
                '}';
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public Integer getSpeed() {
        return speed;
    }

    public void setSpeed(Integer speed) {
        this.speed = Optional.ofNullable(speed).orElse(50);
    }

    public String getDeviceIp() {
        return deviceIp;
    }

    public void setDeviceIp(String deviceIp) {
        this.deviceIp = deviceIp;
    }
}
