package com.dbnt.faisp.main.userInfo.model;


import com.dbnt.faisp.config.BaseModel;

import lombok.AllArgsConstructor;
import lombok.Data;
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 java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;


@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@IdClass(UserEdu.UserEduId.class)
@Table(name = "user_edu")
public class UserEdu extends BaseModel{
  @Id
  @Column(name = "edu_seq")
  private Integer eduSeq;
  @Id
  @Column(name = "user_seq")
  private Integer userSeq;
  @Column(name = "edu_name")
  private String eduName;
  @Column(name = "edu_sdate")
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private LocalDate eduSdate;
  @Column(name = "edu_edate")
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private LocalDate eduEdate;
  @Column(name = "edu_ra")
  private String eduRa;
  @Column(name = "wrt_organ")
  private String wrtOrgan;
  @Column(name = "wrt_part")
  private String wrtPart;
  @Column(name = "wrt_title")
  private String wrtTitle;
  @Column(name = "wrt_user_seq")
  private Integer wrtUserSeq;
  @Column(name = "wrt_nm")
  private String wrtNm;
  @Column(name = "wrt_dt")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
  private LocalDateTime wrtDt;
  
  
  
  
  @Override
public String toString() {
	return "UserEdu [eduSeq=" + eduSeq + ", userSeq=" + userSeq + ", eduName=" + eduName + ", eduSdate=" + eduSdate
			+ ", eduEdate=" + eduEdate + ", eduRa=" + eduRa + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart
			+ ", wrtTitle=" + wrtTitle + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt + "]";
}




@Embeddable
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class UserEduId implements Serializable { 	
    private Integer eduSeq; 
    private Integer userSeq;
  }

}
