package com.dbnt.kcscbackend.commonCode.entity;

import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "tn_cmt_event")
public class TnCmtEvent {

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "evt_seq")
  private Long evtSeq;

  @Column(name = "evt_type")
  private String evtType;

  @Column(name = "up_cmt_seq")
  private Long upCmtSeq;

  @Column(name = "cmt_seq")
  private Long cmtSeq;

  @Column(name = "evt_title")
  private String evtTitle;

  @Column(name = "evt_location")
  private String evtLocation;

  @Column(name = "evt_contents")
  private String evtContents;

  @Column(name = "evt_start_dt")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime evtStartDt;

  @Column(name = "evt_end_dt")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime evtEndDt;

  @Column(name = "frst_crt_id")
  private String frstCrtId;

  @Column(name = "frst_crt_dt")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime frstCrtDt;

  @Column(name = "last_chg_id")
  private String lastChgId;

  @Column(name = "last_chg_dt")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime lastChgDt;

  @Column(name = "use_yn")
  private String useYn;

  @Embeddable
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class TnCmtEventId implements Serializable {
    private Long evtSeq;
  }

}