package com.ltgk.port.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ltgk.common.utils.StringUtils;
import com.ltgk.common.validation.groups.Add;
import com.ltgk.common.validation.groups.Detail;
import com.ltgk.common.validation.groups.Update;
import com.ltgk.port.domain.vo.ParkedAreaForAppVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 重点区域信息/电子围栏/功能区划对象 ds_main_area
 *
 * @author Qi ChengBin
 * @date 2024-12-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ds_main_area")
@ApiModel(value = "重点区域信息/电子围栏/功能区划对象", description = "重点区域信息/电子围栏/功能区划表")
public class DsMainArea extends Model<DsMainArea> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @NotBlank(message = "主键不能为空！", groups = {Update.class, Detail.class})
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty(value = "标注名称")
    @NotBlank(message = "标注名称不能为空！", groups = {Update.class, Add.class})
    @TableField(value = "mark_name", condition = SqlCondition.LIKE)
    private String markName;

    @ApiModelProperty(value = "标注类型  1、管控区域 2、泊区3、待泊区4、航道5、捕捞区6、养殖区")
    @NotNull(message = "标注类型不能为空！", groups = {Update.class, Add.class})
    @TableField(value = "mark_type")
    private Integer markType;

    @ApiModelProperty(value = "编号")
    @TableField(value = "mark_id")
    private Integer markId;

    @ApiModelProperty(value = "类别")
    @TableField(value = "area_type")
    private String areaType;

    @ApiModelProperty(value = "名称显示状态")
    @TableField(value = "name_display_state")
    private String nameDisplayState;

    @ApiModelProperty(value = "填充色")
    @TableField(value = "fill_color")
    private String fillColor;

    @ApiModelProperty(value = "透明度")
    @TableField(value = "diaphaneity")
    private String diaphaneity;

    @ApiModelProperty(value = "线条颜色")
    @TableField(value = "line_color")
    private String lineColor;

    @ApiModelProperty(value = "线框线宽")
    @TableField(value = "line_width")
    private String lineWidth;

    @ApiModelProperty(value = "备注")
    @TableField(value = "remark")
    private String remark;

    @ApiModelProperty(value = "位置信息")
    @TableField(value = "position_info")
    private String positionInfo;

    @ApiModelProperty(value = "历史报警船舶数量")
    @TableField(value = "history_alarm_num")
    private Long historyAlarmNum;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_at")
    private Date createAt;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "修改时间")
    @TableField(value = "update_at")
    private Date updateAt;

    @ApiModelProperty(value = "创建者")
    @TableField(value = "create_by")
    private String createBy;

    @ApiModelProperty(value = "更新者")
    @TableField(value = "update_by")
    private String updateBy;

    @ApiModelProperty(value = "功能区域 1、大型船舶停靠区2、中型船舶停靠区3、小型船舶停靠区4、商船停靠区、5、高速航道6、中速航道7、低速航道")
    @TableField(value = "function_area")
    private Integer functionArea;

    @ApiModelProperty(value = "泊区停靠渔船最大数量")
    @TableField(value = "max_boat_count", updateStrategy = FieldStrategy.IGNORED, insertStrategy = FieldStrategy.IGNORED)
    private String maxBoatCount;

    @ApiModelProperty(value = "泊区停靠渔船最大数量预警值 1-100 百分比")
    @TableField(value = "early_warning", updateStrategy = FieldStrategy.IGNORED, insertStrategy = FieldStrategy.IGNORED)
    private String earlyWarning;

    @ApiModelProperty(value = "泊区航道划分最小功率")
    @TableField(value = "min_power")
    private BigDecimal minPower;

    @ApiModelProperty(value = "泊区航道划分最大功率")
    @TableField(value = "max_power")
    private BigDecimal maxPower;

    @ApiModelProperty(value = "所属渔港id")
    @TableField(value = "port_id")
    private String portId;

    @ApiModelProperty(value = "所属渔港名称")
    @TableField(value = "port_name")
    private String portName;

    @ApiModelProperty(value = "行政区域编码")
    @NotBlank(message = "行政区域编码不能为空", groups = {Update.class, Add.class})
    @TableField(value = "area_code")
    private String areaCode;

    @ApiModelProperty(value = "行政区域名称")
    @NotBlank(message = "行政区域名称不能为空", groups = {Update.class, Add.class})
    @TableField(value = "area_name")
    private String areaName;

    @ApiModelProperty(value = "区域分类 1、重点区域2、电子围栏")
    @TableField(value = "type")
    private Integer type;

    @ApiModelProperty(value = "是否显示； 0 - 不显示 ， 1 - 显示")
    @TableField(value = "be_show")
    private Integer beShow;

    @ApiModelProperty(value = "负责人")
    @TableField(value = "head_user")
    private String headUser;

    @ApiModelProperty(value = "负责人电话")
    @TableField(value = "head_user_phone")
    private String headUserPhone;

    @ApiModelProperty(value = "泊区当前停靠渔船数量")
    @TableField(exist = false)
    private String nowBoatCount;

    @ApiModelProperty(value = "中心点经纬度")
    @TableField(exist = false)
    private ParkedAreaForAppVO.Point center;

    public void setEarlyWarning(String earlyWarning) {
        this.earlyWarning = StringUtils.isBlank(earlyWarning) ? null : earlyWarning;
    }

    public void setMaxBoatCount(String maxBoatCount) {
        this.maxBoatCount = StringUtils.isBlank(maxBoatCount) ? null : maxBoatCount;
    }
}
