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

import cn.hutool.json.JSON;
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_recv")
public class MessageRecvModel extends BaseModel {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;

    @NotNull
    @Column(name = "msg_id", nullable = false)
    private Long msgId;

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

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

    @Column(name = "send_time")
    private Instant sendTime;

    @Size(max = 36)
    @Column(name = "group_id", length = 36)
    private String groupId;

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

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

    @NotNull
    @ColumnDefault("0")
    @Column(name = "status", nullable = false)
    private Integer status;

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

}