package com.ltgk.boat.domain.dto;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.lang.reflect.Field;

/**
 * @Author: wan kun
 * @Description: 新增修改捕捞证书
 * @Date: 2024/12/24 17:55
 * @Version: 1.0
 */
@Data
public class SaveBoatNameReq {
    @ApiModelProperty(value = "船名登记信息唯一标识")
    @JsonProperty("id")
    private String id;
    @NotBlank(message = "渔船信息唯一标识不能为空")
    @ApiModelProperty(value = "渔船信息唯一标识")
    @JsonProperty("boatId")
    private String boatId;
    @ApiModelProperty(value = "渔业船舶船名登记备案核准书编号")
    @JsonProperty("boatNameApprovalCode")
    private String boatNameApprovalCode;
    @ApiModelProperty(value = "渔船船名申请备案核准书编号")
    @JsonProperty("boatNameApplyCode")
    private String boatNameApplyCode;
    @ApiModelProperty(value = "申请人姓名")
    @JsonProperty("applyPersonName")
    private String applyPersonName;
    @ApiModelProperty(value = "申请人居民身份证号码或公司注册")
    @JsonProperty("applyPersonIdcard")
    private String applyPersonIdcard;
    @ApiModelProperty(value = "申请人地址")
    @JsonProperty("applyPersonAddr")
    private String applyPersonAddr;
    @ApiModelProperty(value = "申请人电话")
    @JsonProperty("applyPersonPhone")
    private String applyPersonPhone;
    @ApiModelProperty(value = "原船名")
    @JsonProperty("oldBoatName")
    private String oldBoatName;
    @ApiModelProperty(value = "注销或中止登记证明书编号")
    @JsonProperty("logoutBoatCode")
    private String logoutBoatCode;
    @ApiModelProperty(value = "原渔业捕捞许可证编号")
    @JsonProperty("oldFishingType")
    private String oldFishingType;
    @ApiModelProperty(value = "批准文号")
    @JsonProperty("approvalDocumentNumber")
    private String approvalDocumentNumber;
    @ApiModelProperty(value = "船网工具指标批准书编号")
    @JsonProperty("networkApprovalNum")
    private String networkApprovalNum;
    @ApiModelProperty(value = "远洋项目批准文号")
    @JsonProperty("oceanApprovalDocumentNumber")
    private String oceanApprovalDocumentNumber;
    @ApiModelProperty(value = "申请日期")
    @JsonProperty("applyDate")
    private String applyDate;
    @ApiModelProperty(value = "船名")
    @JsonProperty("boatName")
    private String boatName;
    @ApiModelProperty(value = "操作说明")
    @JsonProperty("remark")
    private String remark;
    @ApiModelProperty("证书有效期")
    @JsonProperty(value = "certificate_validity")
    private String certificateValidity;

    public void checkoutData() throws IllegalAccessException {
        Field[] fields = SaveBoatNameReq.class.getDeclaredFields();
        for (Field field : fields) {
            Object object = field.get(this);
            if (ObjectUtils.isEmpty(object)) {
                field.set(this, null);
            }
        }

    }
}
