package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.helper.Caption;
import lombok.*;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author salmanoe
 * @since Jan 30, 2023
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Table(name = "sdm_slipgajikomponen_t")
public class SlipGajiKomponen implements Serializable {
	private static final long serialVersionUID = -3932381437404780760L;

	@Id
	@GenericGenerator(name = "uuid", strategy = "uuid")
	@GeneratedValue(generator = "uuid")
	@Column(columnDefinition = "CHAR(32)", unique = true)
	@Caption(value = "ID")
	protected String id;

	@ManyToOne
	@JoinColumn(name = "komponengajifk")
	@Caption(value = "Komponen Slip Gaji")
	private KomponenGaji komponen;

	@Column(name = "nominal")
	@Caption(value = "Nominal")
	private BigDecimal nominal;

	@ManyToOne
	@NotNull(message = "Slip Gaji tidak boleh kosong")
	@JoinColumn(name = "slipgajifk", columnDefinition = "CHAR(32)", nullable = false)
	@Caption(value = "Slip Gaji")
	private SlipGaji slipGaji;
}
