package com.r11.tools.model;

import java.time.LocalDateTime;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.lang.Nullable;

/**
 * Pojo class for Event entity
 * @author Rafał Żukowicz
 */
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class Event implements Comparable<Event>{

    @DateTimeFormat(pattern = "yyyy-MM-ddTHH:mm:ss")
    private LocalDateTime dateTimeStamp;
    @Nullable
    private String interfaceName;
    @Nullable
    private String clientUUID;
    @Nullable
    private Integer messageId;
    private String thread;
    private String level;
    @Nullable
    private String message;

    @Override
    public int compareTo(Event o) {
        return this.getDateTimeStamp().compareTo(o.getDateTimeStamp()) * -1;
    }
}
