package com.jasamedika.medifirst2000.entities;

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

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

import static javax.persistence.FetchType.LAZY;

/**
 * @author Salman
 * @version 1.0.0
 * @since 6 Oct 2023
 */
@Getter
@Setter
@Entity
@Table(name = "tarifregulerpaket_m", uniqueConstraints = @UniqueConstraint(columnNames = { "mappaketfk", "kelasfk" }))
public class TarifRegulerPaket extends BaseTransaction {
	private static final long serialVersionUID = 1763466609980920417L;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "mappaketfk")
	@NotNull(message = "Mapping produk paket tidak boleh kosong")
	@Caption(value = "Mapping produk paket")
	private MapProdukPaket mapProdukPaket;

	@Column(name = "mappaketfk", columnDefinition = "CHAR(32)", insertable = false, updatable = false, nullable = false)
	private String mapProdukPaketId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "kelasfk")
	@NotNull(message = "Kelas tidak boleh kosong")
	@Caption(value = "Kelas")
	private Kelas kelas;

	@Column(name = "kelasfk", insertable = false, updatable = false, nullable = false)
	private Integer kelasId;

	@NotNull(message = "Tarif satuan tidak boleh kosong")
	@Column(name = "tarifsatuan", nullable = false)
	@Caption(value = "Tarif satuan")
	private Double tarifSatuan;
}
