package com.yida.data.common.core.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yida.data.common.core.enums.RecordTypeEnum;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 通行记录错误信息
 *
 * @author ZYJ
 * @date 2023/11/1 14:00
 */
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "error_record_msg", shards = 5)
public class ErrorRecordMsg {

    @Id
    private String id;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate;

    /**
     * 学校id
     */
    @Field(type = FieldType.Long)
    private Long schoolId;

    /**
     * 处理的信息. AddAttendanceRecordDTO
     */
    @Field(type = FieldType.Text)
    private String msg;

    /**
     * 消息渠道-内部标识
     */
    @Field(type = FieldType.Text)
    private String topic;

    /**
     * 消息来源渠道
     */
    @Field(type = FieldType.Text)
    private String channel;

    /**
     * 通行记录类型 {@link RecordTypeEnum}
     */
    @Field(type = FieldType.Text)
    private String recordType;
}
