package com.sikey.wa04.business.infrastructure.dto.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;

import java.time.Instant;
import java.util.Map;

@Getter
@Setter
@Entity
@Table(name = "tb_message_send")
public class MessageSendModel extends BaseModel {
    @Id
    @Column(name = "id", nullable = false)
    private Long id;

    @Size(max = 36)
    @NotNull
    @Column(name = "send_id", nullable = false, length = 36)
    private String sendId;

    @NotNull
    @Column(name = "msg_type", nullable = false)
    private Integer msgType;

    @NotNull
    @Column(name = "content", nullable = false)
    @JdbcTypeCode(SqlTypes.JSON)
    private Map<String, Object> content;

    @NotNull
    @ColumnDefault("CURRENT_TIMESTAMP")
    @Column(name = "send_time", nullable = false)
    private Instant sendTime;

    @Column(name = "deleted_at")
    private Instant deletedAt;

}