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 Manoe
 * @version 1.0.0
 * @since 03 Aug 2023
 */
@Getter
@Setter
@Entity
@Table(name = "mapprodukpakettoproduk_m", uniqueConstraints = @UniqueConstraint(columnNames = "mappaketfk"))
public class MapProdukPaketToProduk extends BaseTransaction {

	private static final long serialVersionUID = -3625190975075093756L;

	@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 = "produkfk")
	@NotNull(message = "Produk tidak boleh kosong")
	@Caption(value = "Produk")
	private Produk produkReguler;

	@Column(name = "produkfk", insertable = false, updatable = false, nullable = false)
	private Integer produkRegulerId;

}
