package com.iqser.red.service.persistence.management.v1.processor.entity.download;

import com.iqser.red.service.pdftron.redaction.v1.api.model.RedactionResultDetail;
import com.iqser.red.service.persistence.management.v1.processor.utils.JSONDownloadRedactionFileDetailsConverter;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@Entity
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "download_redaction_file_status")
public class DownloadRedactionFileStatusEntity {

    @Id
    private String id;

    @Column
    private String downloadStorageId;

    @Column
    private String fileId;

    @Column
    private Integer processingErrorCounter;

    @Builder.Default
    @Column(columnDefinition = "text", name = "details")
    @Convert(converter = JSONDownloadRedactionFileDetailsConverter.class)
    private List<RedactionResultDetail> details = new ArrayList<>();

}
