package com.fdkankan.ucenter.vo.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.fdkankan.common.util.DateUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class CameraSpaceVo implements Serializable, Comparable<CameraSpaceVo> {

    private Long id;

    private String childName;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date spaceEndTime;

    private Integer deadlineDays;

    private String content;

    private Long usedSpace;

    private String usedSpaceStr;

    private Double totalSpace;

    private String totalSpaceStr;

    private String spaceEndStr;

    private Long space;

    private String spaceStr;

    private String snCode;

    private Long cameraId;

    @Override
    public int compareTo(CameraSpaceVo o) {
        if (o.getSpaceEndTime() != null) {
            if (DateUtil.after(this.getSpaceEndTime(), o.getSpaceEndTime())) {
                return 1;
            } else if (DateUtil.after(o.getSpaceEndTime(), this.getSpaceEndTime())) {
                return -1;
            }
        }
        return 0;
    }
}
