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

import com.dbnt.faisp.config.BaseModel;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "personnel_status")
@IdClass(PersonnelStatus.personnelStatusId.class)
public class PersonnelStatus extends BaseModel {
  @Id
  @Column(name = "year")
  private String year;
  @Id
  @Column(name = "og_cd")
  private String ogCd;
  @Id
  @Column(name = "version_no")
  private Integer versionNo = 0;
  @Column(name = "jt007_max")
  private Integer jt007Max = 0;
  @Column(name = "jt007_now")
  private Integer jt007Now = 0;
  @Column(name = "jt006_max")
  private Integer jt006Max = 0;
  @Column(name = "jt006_now")
  private Integer jt006Now = 0;
  @Column(name = "jt005_max")
  private Integer jt005Max = 0;
  @Column(name = "jt005_now")
  private Integer jt005Now = 0;
  @Column(name = "jt004_max")
  private Integer jt004Max = 0;
  @Column(name = "jt004_now")
  private Integer jt004Now = 0;
  @Column(name = "jt003_max")
  private Integer jt003Max = 0;
  @Column(name = "jt003_now")
  private Integer jt003Now = 0;
  @Column(name = "jt002_max")
  private Integer jt002Max = 0;
  @Column(name = "jt002_now")
  private Integer jt002Now = 0;
  @Column(name = "jt001_max")
  private Integer jt001Max = 0;
  @Column(name = "jt001_now")
  private Integer jt001Now = 0;
  @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_user_grd")
  private String wrtUserGrd;
  @Column(name = "wrt_user_nm")
  private String wrtUserNm;
  @Column(name = "wrt_dt")
  private LocalDateTime wrtDt;

  @Transient
  private Integer sumMax = 0;
  @Transient
  private Integer sumNow = 0;

  @Embeddable
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class personnelStatusId implements Serializable {
    private String year;
    private String ogCd;
    private Integer versionNo;
  }
}
