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

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

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

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

import com.iqser.red.service.persistence.service.v1.api.shared.model.notification.EmailNotificationType;

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

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "notification_preference")
public class NotificationPreferencesEntity {

    @Id
    private String userId;

    @Column
    private boolean inAppNotificationsEnabled;

    @Column
    private boolean emailNotificationsEnabled;

    @Column
    private EmailNotificationType emailNotificationType;

    @ElementCollection(fetch = FetchType.EAGER)
    @Fetch(FetchMode.SUBSELECT)
    private List<String> emailNotifications = new ArrayList<>();

    @ElementCollection(fetch = FetchType.EAGER)
    @Fetch(FetchMode.SUBSELECT)
    private List<String> inAppNotifications = new ArrayList<>();

}
