package com.dbnt.faisp.main.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.LocalDateTime;
import java.util.List;


@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@IdClass(PartInfo.PartInfoId.class)
@Table(name = "part_info")
public class PartInfo extends BaseModel implements Serializable{
  @Id
  @Column(name = "pi_seq")
  private Integer piSeq;
  @Id
  @Column(name = "version_no")
  private Integer versionNo;
  @Column(name = "mgt_organ")
  private String mgtOrgan;
  @Column(name = "pi_user_seq")
  private Integer piUserSeq;
  @Column(name = "land_police")
  private String landPolice;
  @Column(name = "rent_type")
  private String rentType;
  @Column(name = "rent_price")
  private Integer rentPrice;
  @Column(name = "utility_type")
  private String utilityType;
  @Column(name = "utility_price")
  private Integer utilityPrice;
  @Column(name = "terminal_nm")
  private String terminalNm;
  @Column(name = "mp_work_type")
  private String mpWorkType;
  @Column(name = "mp_people_cnt")
  private Integer mpPeopleCnt;
  @Column(name = "mp_description")
  private String mpDescription;
  @Column(name = "pl_work_type")
  private String plWorkType;
  @Column(name = "pl_people_cnt")
  private Integer plPeopleCnt;
  @Column(name = "pl_description")
  private String plDescription;
  @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;
  
  @Transient
  private List<MultipartFile> multipartFileList;
  
  @Transient
  private String piManagerName;
  
  @Transient
  private String excel;
  
  @Transient
  private List<PartInfoFile> fileList;

  



@Override
public String toString() {
	return "PartInfo [piSeq=" + piSeq + ", versionNo=" + versionNo + ", mgtOrgan=" + mgtOrgan + ", piUserSeq="
			+ piUserSeq + ", landPolice=" + landPolice + ", rentType=" + rentType + ", rentPrice=" + rentPrice
			+ ", utilityType=" + utilityType + ", utilityPrice=" + utilityPrice + ", terminalNm=" + terminalNm
			+ ", mpWorkType=" + mpWorkType + ", mpPeopleCnt=" + mpPeopleCnt + ", mpDescription=" + mpDescription
			+ ", plWorkType=" + plWorkType + ", plPeopleCnt=" + plPeopleCnt + ", plDescription=" + plDescription
			+ ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm
			+ ", wrtDt=" + wrtDt + ", multipartFileList=" + multipartFileList + ", piManagerName=" + piManagerName
			+ ", fileList=" + fileList + "]";
}





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
























}
