package com.ycwl.basic.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * ZT-Source Kafka消息实体
 * 用于接收素材数据（照片和视频片段）
 *
 * @author system
 * @date 2024/12/27
 */
@Data
public class ZTSourceMessage {
    @JsonProperty("sourceId")
    private Long sourceId;

    @JsonProperty("sourceType")
    private Integer sourceType;

    @JsonProperty("scenicId")
    private Long scenicId;

    @JsonProperty("deviceId")
    private Long deviceId;

    @JsonProperty("shootTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date shootTime;

    @JsonProperty("thumbnailUrl")
    private String thumbnailUrl;

    @JsonProperty("sourceUrl")
    private String sourceUrl;

    @JsonProperty("resolution")
    private String resolution;

    @JsonProperty("faceSampleId")
    private Long faceSampleId;

    @JsonProperty("posJson")
    private String posJson;

    /**
     * 判断是否为视频片段
     */
    public boolean isVideo() {
        return sourceType != null && sourceType == 1;
    }

    /**
     * 判断是否为照片
     */
    public boolean isPhoto() {
        return sourceType != null && (sourceType == 2 || sourceType == 3);
    }

}