package com.dbnt.kcscbackend.admin.config.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;

@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "tc_menu")
public class TcMenu {
  @Id
  @Column(name = "menu_id")
  @NotBlank(message = "메뉴코드를 입력해주세요.")
  private String menuId;
  @Column(name = "role_grp_id")
  private String roleGrpId;
  @Column(name = "menu_title")
  @NotBlank(message = "메뉴이름을 입력해주세요.")
  private String menuTitle;
  @Column(name = "menu_group")
  private String menuGroup;
  @Column(name = "menu_level")
  private Integer menuLevel;
  @Column(name = "menu_sort")
  private Integer menuSort;
  @Column(name = "menu_url")
  @NotBlank(message = "메뉴URI를 입력해주세요.")
  private String menuUrl;
  @Column(name = "menu_type_cd")
  @NotBlank(message = "타입을 선택해주세요.")
  private String menuTypeCd;
  @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;

  @Transient
  private String menuTypeValue;

  @Transient
  private String menuAuth;
}
