package com.multictrl.modules.business.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

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


/**
 * 地图标注
 *
 * @author Sdy
 * @since 1.0.0 2026-05-25
 */
@Data
@Schema(name = "地图标注")
public class GeoMarkDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @Schema(description = "主键")
    private Long id;

    @NotBlank(message = "设备编号不能为空")
    @Schema(description = "设备编号 ALL为全部")
    private String dockSn;

    @NotBlank(message = "类型不能为空")
    @Schema(description = "类型 {point:点,line:线,polygon:面,circle:圆}")
    private String markType;

    @NotBlank(message = "标注名称不能为空")
    @Schema(description = "标注名称")
    private String markName;

    @Schema(description = "解释说明")
    private String description;

    @Schema(description = "颜色")
    private String color;

    @Schema(description = "页面显示的字体大小")
    private String fontSize;

    @Schema(description = "图标样式")
    private String iconStyle;

    @Schema(description = "图标url地址")
    private String iconUrl;

    @Schema(description = "点位信息集合，json格式")
    private String pointSet;

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

    @JsonIgnore
    @Schema(hidden = true)
    @AssertTrue(message = "类型错误")
    public boolean isMarkTypeValid() {

        return markType.equals("point") || markType.equals("line") || markType.equals("polygon") || markType.equals("circle");
    }
}
