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

import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;

import jakarta.persistence.Basic;
import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;

import com.iqser.red.service.persistence.management.v1.processor.utils.JSONMapConverter;

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

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "notification")
public class NotificationEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @Column
    private String userId;

    @Column
    private String notificationType;

    @Column
    private String issuerId;

    @Column
    private OffsetDateTime creationDate;

    @Column
    private OffsetDateTime seenDate;

    @Column
    private OffsetDateTime readDate;

    @Column
    private OffsetDateTime softDeleted;

    @Column
    private String notificationDetails;

    @Basic(fetch = FetchType.EAGER)
    @Column(columnDefinition = "text")
    @Convert(converter = JSONMapConverter.class)
    private Map<String, Object> target = new HashMap<>();

}
