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

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

import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

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

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

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "legal_basis_mapping")
public class LegalBasisMappingEntity {

    @Id
    private String dossierTemplateId;
    @Column
    private long version;

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

}
