package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

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

import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.SEQUENCE;

/**
 * class Departemen
 * 
 * @author Generator
 */
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "Departemen_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class Departemen extends BaseMaster {

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

	@Caption(value = "Nama Departemen")
	private String namaDepartemen;

	@Caption(value = "Kode Departemen")
	private String kdDepartemen;

	@Caption(value = "QDepartemen")
	private Byte qDepartemen;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectPegawaiKepalaFk")
	@Caption(value = "Object Pegawai Kepala")
	private LoginUser pegawaiKepala;

	@Column(name = "ObjectPegawaiKepalaFk", insertable = false, updatable = false)
	private Integer pegawaiKepalaId;

	@Caption(value = "Alamat Email")
	private String alamatEmail;

	@Caption(value = "Website")
	private String website;

	@Caption(value = "Faksimile")
	private String faksimile;

	@Caption(value = "Fixed Phone")
	private String fixedPhone;

	@Caption(value = "Mobile Phone")
	private String mobilePhone;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectJenisPerawatanFk")
	@NotNull(message = "Object Jenis Perawatan Harus Diisi")
	@Caption(value = "Object Jenis Perawatan")
	private JenisPerawatan jenisPerawatan;

	@Column(name = "ObjectJenisPerawatanFk", insertable = false, updatable = false)
	private Integer jenisPerawatanId;

	@Caption(value = "Prefix No Antrian")
	private String prefixNoAntrian;

	public Departemen(String kdDepartemen, String namaDepartemen, Integer id) {
		super();
		this.kdDepartemen = kdDepartemen;
		this.namaDepartemen = namaDepartemen;
		this.id = id;
	}

	@Override
	public String toString() {
		return "Departemen [id=" + id + ", namaDepartemen=" + namaDepartemen + ", statusEnabled=" + statusEnabled + "]";
	}

}