package com.muyu.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 预警日志对象 warn_logs
 * @author muyu
 * @date 2024-09-20
 */

@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("warn_logs")
@Tag(name = "预警日志管理")
public class WarnLogs extends BaseEntity{
    private static final Long serialVersionUID = 1L;

    /** 预警日志id */
    @TableId( type = IdType.AUTO)
    @Schema(name = "id")
    private Long id;

    /** 车辆vin码 */
    @Schema(name = "车辆vin码")
    private String vin;

    /** 规则id */
    @Schema(name = "规则id")
    private Long warnRuleId;

    /** 开始时间 */
    @DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    @Schema(name = "开始时间")
    private Date startTime;

    /** 结束时间 */
    @DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    @Schema(name = "结束时间")
    private Date endTime;

    /** 最大值 */
    @Schema(name = "最大值")
    private Long maxValue;

    /** 最小值 */
    @Schema(name = "最小值")
    private Long minValue;

    /** 平均值 */
    @Schema(name = "平均值")
    private Long avgValue;

    /** 中位数 */
    @Schema(name = "中位数")
    private Long medianValue;

    /** 是否发送预警 */
    @Schema(name = "是否发送预警")
    private Long status;

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("vin", getVin())
            .append("warnRuleId", getWarnRuleId())
            .append("startTime", getStartTime())
            .append("endTime", getEndTime())
            .append("maxValue", getMaxValue())
            .append("minValue", getMinValue())
            .append("avgValue", getAvgValue())
            .append("medianValue", getMedianValue())
            .append("status", getStatus())
            .toString();
    }
}
