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.validation.groups.Add;
import com.ltgk.common.validation.groups.Detail;
import com.ltgk.common.validation.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;
import java.util.Date;

/**
 * 渔港对象 ds_port
 *
 * @author Qi ChengBin
 * @date 2024-12-13
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ds_port")
@ApiModel(value = "渔港对象", description = "渔港表")
public class DsPort extends Model<DsPort> {

    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 = "单位ID/部门ID")
    @TableField(value = "dept_id")
    private String deptId;

    @ApiModelProperty(value = "单位名称/部门名称")
    @TableField(value = "dept_name", condition = SqlCondition.LIKE)
    private String deptName;

    @ApiModelProperty(value = "渔港名称")
    @NotBlank(message = "渔港名称不能为空！", groups = {Update.class, Add.class})
    @TableField(value = "port_name", condition = SqlCondition.LIKE)
    private String portName;

    @ApiModelProperty(value = "渔港等级")
    @TableField(value = "port_level", condition = SqlCondition.LIKE)
    private String portLevel;

    @ApiModelProperty(value = "泊位数")
    @DecimalMin(value = "0", message = "泊位数必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "berth_num")
    private String berthNum;

    @ApiModelProperty(value = "经度")
    @NotBlank(message = "经度不能为空", groups = {Update.class, Add.class})
    @TableField(value = "longitude")
    private String longitude;

    @ApiModelProperty(value = "纬度")
    @NotBlank(message = "纬度不能为空", groups = {Update.class, Add.class})
    @TableField(value = "latitude")
    private String latitude;

    @ApiModelProperty(value = "建成时间")
    @Past(message = "建成时间必须小于当前时间！", groups = {Update.class, Add.class})
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @TableField(value = "finish_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate finishTime;

    @ApiModelProperty(value = "渔港类型ID")
    @TableField(value = "type_id")
    private Integer typeId;

    @ApiModelProperty(value = "渔港类型")
    @TableField(value = "type_name", condition = SqlCondition.LIKE)
    private String typeName;

    @ApiModelProperty(value = "年卸港量")
    @DecimalMin(value = "0", message = "年卸港量必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "landings_year")
    private String landingsYear;

    @ApiModelProperty(value = "港区岸线总长")
    @DecimalMin(value = "0", message = "港区岸线总长必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "port_shoreline_length")
    private String portShorelineLength;

    @ApiModelProperty(value = "防波堤总长")
    @DecimalMin(value = "0", message = "防波堤总长必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "port_breakwater_length")
    private String portBreakwaterLength;

    @ApiModelProperty(value = "码头泊位总长")
    @DecimalMin(value = "0", message = "码头泊位总长必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "port_berth_length")
    private String portBerthLength;

    @ApiModelProperty(value = "码头作业面宽")
    @DecimalMin(value = "0", message = "码头作业面宽必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "port_job_area_width")
    private String portJobAreaWidth;

    @ApiModelProperty(value = "港区水深")
    @DecimalMin(value = "0", message = "港区水深必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "port_water_depth")
    private String portWaterDepth;

    @ApiModelProperty(value = "服务设施【水产品市场/水产品加工厂】")
    @TableField(value = "service_facility", condition = SqlCondition.LIKE)
    private String serviceFacility;

    @ApiModelProperty(value = "渔港经营主体-名称")
    @TableField(value = "port_business_entity_name")
    private String portBusinessEntityName;

    @ApiModelProperty(value = "渔港经营主体-地址")
    @TableField(value = "port_business_entity_addr")
    private String portBusinessEntityAddr;

    @ApiModelProperty(value = "渔港经营主体-负责人")
    @TableField(value = "port_business_entity_people")
    private String portBusinessEntityPeople;

    // 正则为匹配中国大陆的手机号格式
    @ApiModelProperty(value = "渔港经营主体-联系电话")
    @Pattern(regexp = "^$|1[3-9]\\d{9}$", message = "手机号码格式不正确！", groups = {Update.class, Add.class})
    @TableField(value = "port_business_entity_tel")
    private String portBusinessEntityTel;

    @ApiModelProperty(value = "渔港监督管理机构-名称")
    @TableField(value = "port_regulatory_bodies_name")
    private String portRegulatoryBodiesName;

    @ApiModelProperty(value = "渔港监督管理机构-地址")
    @TableField(value = "port_regulatory_bodies_addr")
    private String portRegulatoryBodiesAddr;

    @ApiModelProperty(value = "渔港监督管理机构-负责人")
    @TableField(value = "port_regulatory_bodies_people")
    private String portRegulatoryBodiesPeople;

    @ApiModelProperty(value = "渔港监督管理机构-联系电话")
    @TableField(value = "port_regulatory_bodies_tel")
    private String portRegulatoryBodiesTel;

    @ApiModelProperty(value = "区域形状")
    @TableField(value = "area_type")
    private String areaType;

    @ApiModelProperty(value = "渔船码头长度")
    @DecimalMin(value = "0", message = "渔船码头长度必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "boat_wharf")
    private String boatWharf;

    @ApiModelProperty(value = "休闲码头长度")
    @TableField(value = "leisure_wharf")
    private String leisureWharf;

    @ApiModelProperty(value = "水域面积")
    @DecimalMin(value = "0", message = "水域面积必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "water_area")
    private String waterArea;

    @ApiModelProperty(value = "陆域面积")
    @DecimalMin(value = "0", message = "陆域面积必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "land_area")
    private String landArea;

    @ApiModelProperty(value = "总面积")
    @DecimalMin(value = "0", message = "总面积必须为大于0的数字", groups = {Update.class, Add.class})
    @TableField(value = "total_area")
    private String totalArea;

    @ApiModelProperty(value = "渔港所在地/渔港地址")
    @TableField(value = "port_addr_detail", condition = SqlCondition.LIKE)
    private String portAddrDetail;

    @ApiModelProperty(value = "位置信息【范围坐标 -> 港区范围】")
    @TableField(value = "position_info")
    private String positionInfo;

    @ApiModelProperty(value = "名称显示状态【true/false】")
    @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 = "行政区域编码")
    @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;

    @TableLogic(delval = "1", value = "0")
    @TableField(value = "del_flag")
    @ApiModelProperty(value = "删除标志: 0-未删除, 1-已删除")
    private Integer delFlag;

    @ApiModelProperty(value = "排序码")
    @TableField(value = "sort")
    private Integer sort;

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

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

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

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "更新时间")
    @TableField(value = "update_at")
    private Date updateAt;

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

    @ApiModelProperty(value = "当前在港渔船数量")
    @TableField(exist = false)
    private Long boatNumInPort;
}
