package org.springblade.openapi.ocr.pojo.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.openapi.ocr.pojo.vo.result.AttachmentType;
import org.springblade.openapi.ocr.pojo.vo.result.ErrorAttachmentType;
import org.springblade.openapi.ocr.pojo.vo.result.ErrorField;
import org.springblade.openapi.ocr.pojo.vo.result.TransportCertificateBatchDetailData;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * @author bfhuange
 * @since 2025/4/22
 */
@Data
@Schema(description = "凭证ocr结果")
public class Api4OCRResultVO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class, nullsUsing = NullSerializer.class)
    @Schema(description = "主键")
    private Long id;

    /**
     * 凭证号
     */
    @Schema(description = "凭证号")
    private String code;

    /**
     * 识别类型（batch 批量识别，mixed 单张识别合并）
     */
    @Schema(description = "识别类型（batch 批量识别，mixed 单张识别合并）")
    private String identifyType;

    /**
     * 是否类型错误（1 否 2 是）
     */
    @JsonSerialize(nullsUsing = NullSerializer.class)
    @Schema(description = "是否类型错误（1 否 2 是）")
    private Integer isTypeError;

    /**
     * 是否数据错误（1 否 2 是）
     */
    @JsonSerialize(nullsUsing = NullSerializer.class)
    @Schema(description = "是否数据错误（1 否 2 是）")
    private Integer isDataError;

    /**
     * 附件类型列表
     */
    @Schema(description = "附件类型列表")
    private List<AttachmentType> attachmentTypeList;

    /**
     * 数据
     */
    @Schema(description = "数据")
    private TransportCertificateBatchDetailData data;

    /**
     * 错误类型列表
     */
    @Schema(description = "错误类型列表")
    private List<ErrorAttachmentType> errorTypeList;

    /**
     * 错误字段列表
     */
    @Schema(description = "错误字段列表")
    private List<ErrorField> errorFieldList;

    /**
     * 错误字段列表
     */
    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @Schema(description = "创建时间")
    private Date createTime;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @Schema(description = "更新时间")
    private Date updateTime;
}
