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

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

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "report_template")
public class ReportTemplateEntity {

    @Id
    private String templateId;

    @Column
    private String storageId;
    @Column
    private String fileName;
    @Column
    private OffsetDateTime uploadDate;
    @Column
    private boolean multiFileReport;
    @Column
    private boolean activeByDefault;

    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    private DossierTemplateEntity dossierTemplate;

    @Column(updatable = false, insertable = false, name = "dossier_template_id")
    private String dossierTemplateId;

    @ManyToMany
    @JsonIgnore
    private List<DossierEntity> dossiers = new ArrayList<>();

}
