package com.ltgk.port.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author: wan kun
 * @Description: 渔船航行状态
 * @Date: 2025/1/13 9:58
 * @Version: 1.0
 */
@Data
public class BoatNavigateStatusVo {

    @JsonProperty("boatId")
    @ApiModelProperty(value = "渔船id")
    private String boatId;

    @JsonProperty("boatName")
    @ApiModelProperty(value = "渔船名称")
    private String boatName;

    @JsonProperty("name")
    @ApiModelProperty(value = "船牌号")
    private String name;

    @JsonProperty("deviceType")
    @ApiModelProperty(value = "设备类型")
    private String deviceType;

    @JsonProperty("terminalCode")
    @ApiModelProperty(value = "终端编号")
    private String terminalCode;

    @JsonProperty("longitude")
    @ApiModelProperty(value = "经度")
    private Double longitude;

    @JsonProperty("latitude")
    @ApiModelProperty(value = "纬度")
    private Double latitude;

    @JsonProperty("sog")
    @ApiModelProperty(value = "速度")
    private Double sog;

    @JsonProperty("cog")
    @ApiModelProperty(value = "航向")
    private Double cog;

    @JsonProperty("heading")
    @ApiModelProperty(value = "首航向")
    private Double heading;

    @JsonProperty("gpsTime")
    @ApiModelProperty(value = "GPS时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gpsTime;

    @JsonProperty("boatLength")
    @ApiModelProperty(value = "船长")
    private BigDecimal boatLength;

    @JsonProperty("region")
    @ApiModelProperty(value = "区域")
    private String region;

    @JsonProperty("moldedBreadth")
    @ApiModelProperty(value = "船宽")
    private BigDecimal moldedBreadth;

    @JsonProperty("dataSource")
    @ApiModelProperty(value = "设备类型名")
    private String dataSource;

    public void setLongitude(Double longitude) {
        this.longitude = Math.round(longitude * 1000000.0) / 1000000.0;
    }

    public void setLatitude(Double latitude) {
        this.latitude = Math.round(latitude * 1000000.0) / 1000000.0;
    }
}
