package com.dbnt.faisp.fipTarget.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 org.springframework.web.multipart.MultipartFile;

import javax.persistence.*;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;


@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@IdClass(PartWork.PartWorkId.class)
@Table(name = "part_work")
public class PartWork extends BaseModel implements Serializable{
  @Id
  @Column(name = "pw_seq")
  private Integer pwSeq;
  @Id
  @Column(name = "pi_seq")
  private Integer piSeq;
  @Column(name = "work_dt")
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private LocalDate workDt;
  @Column(name = "work_type")
  private String workType;
  @Column(name = "work_info")
  private String workInfo;
  @Column(name = "description")
  private String description;
  @Column(name = "save_yn")
  private String saveYn;
  @Column(name = "wrt_organ")
  private String wrtOrgan;
  @Column(name = "wrt_part")
  private String wrtPart;
  @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 List<MultipartFile> multipartFileList;
  
  @Transient
  private String excel;
  @Transient
  private String terminalNm;
  @Transient
  private String workTypeCh;
  @Transient
  private String workTypePoci;
  @Transient
  private String workTypeSri;
  @Transient
  private String workTypeJi;
  @Transient
  private String workTypeMt;
  @Transient
  private String workTypeEtc;
  @Transient
  private Integer fileCnt;
  
  @Transient
  private List<PartWorkFile> fileList;

  


@Override
public String toString() {
	return "PartWork [pwSeq=" + pwSeq + ", piSeq=" + piSeq + ", workDt=" + workDt + ", workType=" + workType
			+ ", workInfo=" + workInfo + ", description=" + description + ", saveYn=" + saveYn + ", wrtOrgan="
			+ wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt
			+ ", multipartFileList=" + multipartFileList + ", excel=" + excel + ", fileList=" + fileList + "]";
}




@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class PartWorkId implements Serializable { 	
  private Integer pwSeq;	
  private Integer piSeq; 
}
























}
