package com.willalp.control.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.willalp.common.annotation.Excel;
import com.willalp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 控制设备状态信息对象 hs_control_device_info
 *
 * @author willalp
 * @date 2022-02-16
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("hs_control_device_info")
public class HsControlDeviceInfo extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId
    private Long id;

    /**
     * 用户ID
     */
    @Excel(name = "用户ID")
    private Long userId;

    /**
     * 设备ID
     */
    @Excel(name = "设备ID")
    private String deviceId;

    /**
     * 执行口ID
     */
    @Excel(name = "执行口ID")
    private String deviceUseNo;

    /**
     * 设备名字
     */
    @Excel(name = "设备名字")
    private String deviceName;

    /**
     * 用量
     */
    @Excel(name = "用量")
    private String dosage;

    /**
     * XX时XX分 统计用时
     */
    private Long statTime;

    /**
     * 用量单位
     */
    @Excel(name = "用量单位")
    private String dosageUnit;

    /**
     * 用量百分比
     */
    @Excel(name = "用量百分比")
    private Integer dosagePct;

    /**
     * 设备图标
     */
    @Excel(name = "设备图标")
    private String deviceIcon;

    /**
     * 背景颜色
     */
    @Excel(name = "背景颜色")
    private String pageBgkcolor;

    /**
     * 运行状态（0=关，1=开）
     */
    @Excel(name = "运行状态", readConverterExp = "0==关，1=开")
    private Integer runningStatus;

    /**
     * 最近打开时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Excel(name = "最近打开时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastOpenTime;

    /**
     * 最近关闭时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Excel(name = "最近关闭时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastCloseTime;

    /**
     * 是否删除（0.未删除；1.已删除）
     */
    private Integer isDelete;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("deviceId", getDeviceId())
                .append("deviceName", getDeviceName())
                .append("dosage", getDosage())
                .append("dosageUnit", getDosageUnit())
                .append("dosagePct", getDosagePct())
                .append("deviceIcon", getDeviceIcon())
                .append("pageBgkcolor", getPageBgkcolor())
                .append("runningStatus", getRunningStatus())
                .append("lastOpenTime", getLastOpenTime())
                .append("lastCloseTime", getLastCloseTime())
                .append("isDelete", getIsDelete())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }
}
