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

import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;

import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "manual_resize_redaction")
public class ManualResizeRedactionEntity implements IBaseAnnotation {

    @EmbeddedId
    private AnnotationEntityId id;
    @Column(name = "user_id")
    private String user;
    @Column
    @Enumerated(EnumType.STRING)
    private AnnotationStatus status;
    @Column
    private OffsetDateTime requestDate;
    @Column
    private OffsetDateTime processedDate;
    @Column
    private OffsetDateTime softDeletedTime;
    @Column
    private int page;
    @Column(length = 4000)
    private String value;
    @Column
    private Boolean updateDictionary;

    @ManyToOne(fetch = FetchType.LAZY)
    private FileEntity fileStatus;

    @ElementCollection
    @Fetch(FetchMode.SUBSELECT)
    private List<RectangleEntity> positions = new ArrayList<>();

    @Column
    private String textBefore;
    @Column
    private String textAfter;

    @Column
    private boolean addToAllDossiers;

    @ElementCollection
    @Fetch(value = FetchMode.SUBSELECT)
    private Set<String> typeIdsOfModifiedDictionaries = new HashSet<>();
}
