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

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

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.ManyToOne;
import jakarta.persistence.Table;

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 lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

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

    @EmbeddedId
    private AnnotationEntityId id;
    @Column(name = "user_id")
    private String user;
    @Column
    @Enumerated(EnumType.STRING)
    private AnnotationStatus status;
    @Column
    private boolean removeFromDictionary;
    @Column
    private boolean removeFromAllDossiers;
    @Column
    private OffsetDateTime requestDate;
    @Column
    private OffsetDateTime processedDate;
    @Column
    private OffsetDateTime softDeletedTime;
    @Column
    private int page;

    @ManyToOne
    private FileEntity fileStatus;

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

}
