package com.ltgk.boat.domain.entity;


import com.ltgk.common.constant.CacheConstants;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.solr.core.mapping.Indexed;
import org.springframework.data.solr.core.mapping.SolrDocument;

import java.util.Date;

/**
 * solr轨迹接续实体
 *
 * @author Qi ChengBin
 * @date 2025/10/27
 */
@Data
@SolrDocument(collection = CacheConstants.radarPoint)
public class TrackSolrEntity {

    @Id
    @Indexed(name = "id", type = "String")
    @ApiModelProperty("主键")
    private String id;

    @ApiModelProperty("固定值，便于订阅端做类型路由")
    @Indexed(name = "type", type = "string")
    public String type;

    @ApiModelProperty("轨迹ID：按日自增，跨天重置，这是接续后的跟踪id，用它做主画轨迹")
    @Indexed(name = "track_id", type = "string")
    public String track_id;

    @ApiModelProperty("片段序号：同一轨迹内第几个片段")
    @Indexed(name = "segment_id", type = "int")
    public Integer segment_id;

    @ApiModelProperty("设备/目标的唯一ID（就是targetSourceId，太长了不想打，重命名了一下）")
    @Indexed(name = "local_id", type = "string")
    public String local_id;


    @ApiModelProperty("经度")
    @Indexed(name = "lon", type = "double")
    public Double lon;

    @ApiModelProperty("纬度")
    @Indexed(name = "lat", type = "double")
    public Double lat;

    @ApiModelProperty("内部米级近似投影X（调试/可忽略）")
    @Indexed(name = "x", type = "double")
    public Double x;

    @ApiModelProperty("内部米级近似投影Y（调试/可忽略）")
    @Indexed(name = "y", type = "double")
    public Double y;

    @ApiModelProperty("Unix秒级时间戳")
    @Indexed(name = "ts", type = "long")
    public Long ts;

    @ApiModelProperty("ISO时间")
    @Indexed(name = "t_iso", type = "date")
    public Date t_iso;

    @ApiModelProperty("速度m/s")
    @Indexed(name = "speed", type = "double")
    public Double speed;

    @ApiModelProperty("航向")
    @Indexed(name = "course", type = "double")
    public Double course;

    @ApiModelProperty("该轨迹内第几个累计点数（从1开始）")
    @Indexed(name = "n", type = "int")
    public Integer n;

    @ApiModelProperty("若true，表示这点在该轨迹开始了一个新片段")
    @Indexed(name = "new_segment", type = "boolean")
    public boolean new_segment;

    @ApiModelProperty("若true，表示这是新轨迹的第一点，除了第一点外全为false")
    @Indexed(name = "new_track", type = "boolean")
    public boolean new_track;
}
