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 SaveBoatNationalityReq {
    @ApiModelProperty(value = "国籍所有权登记信息唯一标识")
    @JsonProperty("id")
    private String id;
    @NotBlank(message = "渔船信息唯一标识不能为空")
    @ApiModelProperty("渔船信息唯一标识")
    @JsonProperty("boatId")
    private String boatId;
    @ApiModelProperty("渔业船舶所有权登记证书编号")
    @JsonProperty("ownershipCode")
    private String ownershipCode;
    @ApiModelProperty("渔业船舶国籍证书编号")
    @JsonProperty("nationalityCode")
    private String nationalityCode;
    @ApiModelProperty("渔业船舶登记证书有效期")
    @JsonProperty("certificateValidity")
    private String certificateValidity;
    @ApiModelProperty("船籍港")
    @JsonProperty("homePort")
    private String homePort;
    @ApiModelProperty("船籍港英文")
    @JsonProperty("homePortEn")
    private String homePortEn;
    @ApiModelProperty("所有权国籍登记审批机关")
    @JsonProperty("approvalAuthority")
    private String approvalAuthority;
    @ApiModelProperty("所有权国籍登记审批机关意见")
    @JsonProperty("approvalAuthorityOpinion")
    private String approvalAuthorityOpinion;
    @ApiModelProperty("所有权国籍登记审批人")
    @JsonProperty("approvalPerson")
    private String approvalPerson;
    @ApiModelProperty("所有权国籍登记审批时间")
    @JsonProperty("approvalDate")
    private String approvalDate;
    @ApiModelProperty("所有权国籍登记申请书编号")
    @JsonProperty("applyCode")
    private String applyCode;
    @ApiModelProperty("所有权国籍登记申请日期")
    @JsonProperty("applyDate")
    private String applyDate;
    @ApiModelProperty("所有权股份")
    @JsonProperty("ownerShare")
    private String ownerShare;
    @ApiModelProperty("渔业船舶临时国籍证书编号")
    @JsonProperty("temporaryNationalityCode")
    private String temporaryNationalityCode;
    @ApiModelProperty("渔业船舶在建所有权证书编号")
    @JsonProperty("buildHolderCode")
    private String buildHolderCode;
    @ApiModelProperty("持证人名称")
    @JsonProperty("certificateHolderName")
    private String certificateHolderName;
    @ApiModelProperty("持证人名称英文")
    @JsonProperty("certificateHolderNameEn")
    private String certificateHolderNameEn;
    @ApiModelProperty("持证人地址")
    @JsonProperty("certificateHolderAddr")
    private String certificateHolderAddr;
    @ApiModelProperty("持证人地址英文")
    @JsonProperty("certificateHolderAddrEn")
    private String certificateHolderAddrEn;
    @ApiModelProperty("持证人证件号码")
    @JsonProperty("certificateHolderIdcard")
    private String certificateHolderIdcard;
    @ApiModelProperty("持证人电话")
    @JsonProperty("certificateHolderPhone")
    private String certificateHolderPhone;
    @ApiModelProperty("渔业船舶国籍证书有效期")
    @JsonProperty("nationalityCertificateValidity")
    private String nationalityCertificateValidity;
    @ApiModelProperty("共有人信息")
    @JsonProperty("coOwnerInfo")
    private String coOwnerInfo;
    @ApiModelProperty("船舶经营方")
    @JsonProperty("operate")
    private String operate;
    @ApiModelProperty("船舶经营方英文")
    @JsonProperty("operateEn")
    private String operateEn;
    @ApiModelProperty("船旗国")
    @JsonProperty("flagState")
    private String flagState;
    @ApiModelProperty("船旗国英文")
    @JsonProperty("flagStateEn")
    private String flagStateEn;
    @ApiModelProperty("船舶经营方地址")
    @JsonProperty("operateAddr")
    private String operateAddr;
    @ApiModelProperty("船舶经营方地址英文")
    @JsonProperty("operateAddrEn")
    private String operateAddrEn;
    @ApiModelProperty("船名")
    @JsonProperty("boatName")
    private String boatName;
    @ApiModelProperty("核准船长")
    @JsonProperty("approvalLength")
    private String approvalLength;
    @ApiModelProperty("核准总吨")
    @JsonProperty("approvalTonnage")
    private String approvalTonnage;
    @ApiModelProperty("船舶照片")
    @JsonProperty("boatImage")
    private String boatImage;
    @ApiModelProperty("船舶所有人照片")
    @JsonProperty("boatHolderImage")
    private String boatHolderImage;
    @ApiModelProperty("本次发放证书类型")
    @JsonProperty("certificateType")
    private String certificateType;
    @ApiModelProperty("操作说明")
    @JsonProperty("remark")
    private String remark;

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

    }
}
