package com.dbnt.sims.codeMgt.model;

import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

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

@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "code_mgt")
@IdClass(CodeMgt.CodeMgtId.class)
public class CodeMgt {
  @Id
  @Column(name = "category_cd")
  private String categoryCd;
  @Id
  @Column(name = "item_cd")
  private String itemCd;
  @Column(name = "item_value", nullable = false)
  private String itemValue;
  @Column(name = "use_chk")
  private String useChk;

  @Transient
  private String status;

  @Override
	public String toString() {
		return "CodeMgt [categoryCd=" + categoryCd + ", itemCd=" + itemCd + ", itemValue=" + itemValue + ", useChk="
				+ useChk + ", status=" + status + "]";
	}

  @Embeddable
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CodeMgtId implements Serializable {
    private String categoryCd;
    private String itemCd;
  }

}
