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 javax.persistence.*;

import java.io.Serializable;
import java.time.LocalDateTime;


@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@IdClass(ShipInfo.ShipInfoId.class)
@Table(name = "ship_info")
public class ShipInfo extends BaseModel implements Serializable{
  @Id
  @Column(name = "si_seq")
  private Integer siSeq;
  @Id
  @Column(name = "si_type")
  private String siType;
  @Id
  @Column(name = "version_no")
  private Integer versionNo;
  @Column(name = "start_point")
  private String startPoint;
  @Column(name = "end_point")
  private String endPoint;
  @Column(name = "distance_nm")
  private String distanceNm;
  @Column(name = "distance_km")
  private String distanceKm;
  @Column(name = "owner_nm")
  private String ownerNm;
  @Column(name = "ship_nm")
  private String shipNm;
  @Column(name = "operation_cnt")
  private String operationCnt;
  @Column(name = "ship_weight")
  private Double shipWeight;
  @Column(name = "passenger_cnt")
  private Integer passengerCnt;
  @Column(name = "freight_cnt")
  private Integer freightCnt;
  @Column(name = "close_yn")
  private String closeYn;
  @Column(name = "description")
  private String description;
  @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_title")
  private String wrtTitle;
  @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 weightStr;


@Override
public String toString() {
	return "ShipInfo [siSeq=" + siSeq + ", siType=" + siType + ", versionNo=" + versionNo + ", startPoint=" + startPoint
			+ ", endPoint=" + endPoint + ", distanceNm=" + distanceNm + ", distanceKm=" + distanceKm + ", ownerNm="
			+ ownerNm + ", shipNm=" + shipNm + ", operationCnt=" + operationCnt + ", shipWeight=" + shipWeight
			+ ", passengerCnt=" + passengerCnt + ", freightCnt=" + freightCnt + ", description=" + description
			+ ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq + ", wrtTitle="
			+ wrtTitle + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt + ", excel=" + excel + "]";
}




@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ShipInfoId implements Serializable { 	
  private Integer siSeq;
  private String siType;
  private Integer versionNo;
}
























}
