package com.xy.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xy.utils.PageBean;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 机器-联网记录
 * </p>
 *
 * @author lijin
 * @since 2023-01-09
 */
public class DeviceNetRecordDto {

    @Data
    @Accessors(chain = true)
    public static class OffLineDevice {

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "离线时间-起")
        private LocalDateTime beginTime;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "离线时间-始")
        private LocalDateTime endTime;
    }

    @Data
    @Accessors(chain = true)
    public static class Page extends Vo {

        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

        @JsonFormat(pattern = "yyyy-MM-dd")
        @ApiModelProperty(value = "创建时间-起")
        private LocalDate beginCreateTime;

        @JsonFormat(pattern = "yyyy-MM-dd")
        @ApiModelProperty(value = "创建时间-始")
        private LocalDate endCreateTime;

        public LocalDateTime getBeginCreateTime() {
            return beginCreateTime == null ? null : beginCreateTime.atTime(0, 0, 0);
        }

        public LocalDateTime getEndCreateTime() {
            return endCreateTime == null ? null : endCreateTime.atTime(23, 59, 59);
        }

    }

    @Data
    @Accessors(chain = true)
    public static class Save extends Vo {

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty(value = "机器编号", required = true)
        private Long deviceId;
    }

    @Data
    @Accessors(chain = true)
    public static class SelectList extends Vo {

        @ApiModelProperty(value = "id")
        private List<Integer> ids;

        @ApiModelProperty(value = "机器编号")
        private List<Long> deviceIds;

        @ApiModelProperty(value = "商户ID")
        private List<Long> mercIds;

        @ApiModelProperty(value = "联网方式;WIFI,网线，2G，4G..")
        private List<Integer> netTypes;
    }

    @Data
    @Accessors(chain = true)
    public static class Vo {

        @ApiModelProperty(value = "id")
        private Integer id;

        @ApiModelProperty(value = "机器编号")
        private Long deviceId;

        @ApiModelProperty(value = "商户ID")
        private Long mercId;

        @ApiModelProperty(value = "状态")
        private Integer netStatus;

        @ApiModelProperty(value = "联网方式;WIFI,网线，2G，4G..")
        private Integer netType;

        @ApiModelProperty(value = "ICCID卡号")
        private String simIccid;

        @ApiModelProperty(value = "信号值")
        private Integer simDbm;

        @ApiModelProperty(value = "信号类型")
        private String simSignalType;

        @ApiModelProperty(value = "上位版本号")
        private String appUpmVersion;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "创建时间")
        private LocalDateTime createTime;

    }

    @Data
    @Accessors(chain = true)
    public static class OffLineDeviceVo {

        @ApiModelProperty(value = "设备id")
        private Long deviceId;

        @ApiModelProperty(value = "商户id")
        private Long mercId;

        @ApiModelProperty(value = "设备名称")
        private String deviceName;

        @ApiModelProperty(value = "商户名称")
        private String mercName;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "离线时间")
        private LocalDateTime createTime;
    }
}
