package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import static javax.persistence.GenerationType.SEQUENCE;

/**
 * class KomponenHarga
 * 
 * @author Generator
 */
@Getter
@Setter
@Entity
@Table(name = "KomponenHarga_M")
public class KomponenHarga extends BaseMaster {

	@ManyToOne
	@JoinColumn(name = "ObjectDepartemenFk")
	@Caption(value = "Object Departemen")
	private Departemen departemen;

	@Column(name = "ObjectDepartemenFk", insertable = false, updatable = false)
	private Integer departemenId;

	@ManyToOne
	@JoinColumn(name = "ObjectJenisKomponenHargaFk")
	@NotNull(message = "Kd Jenis Komponen Harga tidak boleh kosong")
	@Caption(value = "Object Jenis Komponen Harga")
	private JenisKomponenHarga jenisKomponenHarga;

	@Column(name = "ObjectJenisKomponenHargaFk", insertable = false, updatable = false)
	private Integer jenisKomponenHargaId;

	@NotNull(message = "Kd Komponen Harga tidak boleh kosong")
	@Column(name = "KdKomponenHarga", nullable = false)
	@Caption(value = "Kode Komponen Harga")
	private Byte kdKomponenHarga;

	@ManyToOne
	@JoinColumn(name = "ObjectProdukPKFk")
	@Caption(value = "Object Produk P K")
	private Produk produkPK;

	@Column(name = "ObjectProdukPKFk", insertable = false, updatable = false, nullable = false)
	private Integer produkPKId;

	@NotNull(message = "Komponen Harga tidak boleh kosong")
	@Column(name = "KomponenHarga", nullable = false, length = 20)
	@Caption(value = "Komponen Harga")
	private String komponenHarga;

	@Column(name = "NilaiNormal")
	@Caption(value = "Nilai Normal")
	private Short nilaiNormal;

	@NotNull(message = "No Urut tidak boleh kosong")
	@Column(name = "NoUrut", nullable = false)
	@Caption(value = "No Urut")
	private Byte noUrut;

	@NotNull(message = "QKomponen Harga tidak boleh kosong")
	@Column(name = "QKomponenHarga", nullable = false)
	@Caption(value = "QKomponen Harga")
	private Byte qKomponenHarga;

	@Column(name = "FactorRate")
	@Caption(value = "Factor Rate")
	private Integer factorRate;

	@Column(name = "OperatorFactorRate")
	@Caption(value = "Operator Factor Rate")
	private String operatorFactorRate;

	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "public.komponenharga_m_id_seq")
	@SequenceGenerator(name = "public.komponenharga_m_id_seq", sequenceName = "public.komponenharga_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

}