package com.multictrl.modules.business.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.multictrl.common.validator.group.AddGroup;
import com.multictrl.common.validator.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;

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

/**
 * 航线信息表
 *
 * @author Sdy
 * @since 1.0.0 2026-04-20
 */
@Data
@Schema(name = "航线信息表")
public class RouteDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Null(message = "{id.null}", groups = AddGroup.class)
    @NotNull(message = "{id.require}", groups = UpdateGroup.class)
    @Schema(description = "标识")
    private Long id;

    @NotBlank(message = "{route.name.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "航线名称")
    private String routeName;

    @NotBlank(message = "{route.type.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "航线类型")
    private String templateType;

    @NotBlank(message = "{route.height.model.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "高度模式")
    private String heightModel;

    @NotNull(message = "{route.flight.speed.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "飞行速度")
    private Double flightSpeed;

    @NotNull(message = "{route.flight.height.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "飞行高度")
    private Double flightHeight;

    @NotNull(message = "{route.global.rth.height.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "返航高度")
    private Double globalRthHeight;

    @NotNull(message = "{route.takeoff.security.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "安全起飞高度")
    private Double takeoffSecurityHeight;

    @NotBlank(message = "{route.finish.action.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "结束动作")
    private String finishAction;

    @NotBlank(message = "{route.exit.on.rc.lost.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "失控操作")
    private String exitOnRcLost;

    @Schema(description = "失控动作")
    private String executeRcLostAction;

    @NotNull(message = "{route.global.transitional.speed.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "全局航线过渡速度")
    private Double globalTransitionalSpeed;

    @NotBlank(message = "{route.fly.to.wayline.mode.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "飞向首航点模式")
    private String flyToWaylineMode;

    @NotBlank(message = "{dock.sn.require}", groups = {AddGroup.class, UpdateGroup.class})
    @JsonProperty(required = true)
    @Schema(description = "机库SN码")
    private String dockSn;

   /* @Schema(description = "所属部门")
    private Long deptId;*/

    @Schema(description = "图片地址")
    private String imgUrl;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @Schema(description = "kmz地址")
    private String kmzUrl;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @Schema(description = "Q20航线ID（Q20设备上报的wayline ID）")
    private String q20RouteId;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @Schema(description = "航点个数")
    private Integer waypointNum;

    @JsonProperty(required = true)
    @NotNull(message = "{route.total.distance.require}", groups = {AddGroup.class, UpdateGroup.class})
    @Schema(description = "总距离")
    private Double totalDistance;

    @JsonProperty(required = true)
    @NotNull(message = "{route.expect.flight.time.require}", groups = {AddGroup.class, UpdateGroup.class})
    @Schema(description = "预计飞行时长")
    private String expectFlightTime;

    @JsonProperty(required = true)
    @NotNull(message = "{route.is.accurate.import.require}", groups = {AddGroup.class, UpdateGroup.class})
    @Schema(description = "是否精准导入")
    private Boolean isAccurateImport;

    @Schema(description = "更新时间")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Date updateDate;

    @JsonProperty(required = true)
    @Schema(description = "航点信息")
    private List<RouteWaypointDTO> routeWaypointList;
}
