package com.multictrl.modules.business.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
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.Valid;
import jakarta.validation.constraints.*;
import jakarta.validation.groups.Default;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

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


/**
 * 禁飞区
 *
 * @author Sdy
 * @since 1.0.0 2026-06-09
 */
@Data
@Schema(name = "禁飞区")
public class NoflyZoneDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Null(message = "标识必须为空", groups = {AddGroup.class})
    @NotNull(message = "标识不能为空", groups = {UpdateGroup.class})
    @Schema(description = "标识")
    private Long id;

    @Schema(description = "名称")
    @NotBlank(message = "名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    @NotBlank(message = "是否开启不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Schema(description = "是否开启 1开启 0未开启")
    private String status;

    @Schema(description = "范围")
    @NotEmpty(message = "范围不能为空", groups = {AddGroup.class})
    @Size(min = 2, max = 2, message = "范围数据错误", groups = {AddGroup.class})
    private List<List<@Valid point>> extent;

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

    @Schema(hidden = true)
    private String deptName;

    @Schema(hidden = true)
    private String userName;

    @Schema(hidden = true)
    @JsonIgnore
    private String extentWkt;

    @AllArgsConstructor
    @NoArgsConstructor
    @Data
    public static class point {

        @NotNull(message = "经度不能为空", groups = {AddGroup.class})
        @Schema(description = "经度")
        private Double lng;

        @NotNull(message = "纬度不能为空", groups = {AddGroup.class})
        @Schema(description = "纬度")
        private Double lat;

        @NotNull(message = "海拔高度不能为空", groups = {AddGroup.class})
        @Schema(description = "海拔高度")
        private Double height;
    }
}
