package com.dbnt.sims.equip.model;

import com.dbnt.sims.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(UseList.UseListId.class)
@Table(name = "use_list")
public class UseList extends BaseModel implements Serializable{
  @Id
  @Column(name = "mgt_organ")
  private String mgtOrgan;
  @Id
  @Column(name = "use_no")
  private String useNo;
  @Id
  @Column(name = "version_no")
  private Integer versionNo;
  @Id
  @Column(name = "use_type")
  private String useType;
  @Column(name = "use_dt")
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private LocalDate useDt;
  @Column(name = "detail_type")
  private String detailType;
  @Column(name = "detail_self")
  private String detailSelf;
  @Column(name = "people_cnt")
  private Integer peopleCnt;
  @Column(name = "description")
  private String description;
  @Column(name = "wrt_organ")
  private String wrtOrgan;
  @Column(name = "wrt_part")
  private String wrtPart;
  @Column(name = "wrt_user_grd")
  private String wrtUserGrd;
  @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;
  
  @Transient
  private String excel;
  
  @Transient
  private String sosok;
  
  @Transient
  private String year;
  @Transient
  private String detailTypeName;

  
@Override
public String toString() {
	return "UseList [mgtOrgan=" + mgtOrgan + ", useNo=" + useNo + ", versionNo=" + versionNo + ", useType=" + useType
			+ ", useDt=" + useDt + ", detailType=" + detailType + ", detailSelf=" + detailSelf + ", peopleCnt="
			+ peopleCnt + ", description=" + description + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart
			+ ", wrtUserGrd=" + wrtUserGrd + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt
			+ ", excel=" + excel + ", sosok=" + sosok + ", year=" + year + ", detailTypeName=" + detailTypeName + "]";
}


@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class UseListId implements Serializable { 	
  private String mgtOrgan;
  private String useNo;  
  private Integer versionNo;
  private String useType; 
}
























}
