package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

import static javax.persistence.CascadeType.ALL;
import static javax.persistence.FetchType.LAZY;

@Getter
@Setter
@Entity
@Table(name = "ManajemenPromosi_T")
public class ManajemenPromosi extends BaseTransaction {

	@Column(name = "NoPks", length = 200)
	@Caption(value = "noPks")
	private String noPks;

	@ManyToOne
	@JoinColumn(name = "ObjectJenisMediaFk")
	@Caption(value = "Jenis Media")
	private JenisMedia jenisMedia;

	@Column(name = "ObjectJenisMediaFk", insertable = false, updatable = false)
	private Integer jenisMediaId;

	@Column(name = "JenisMedia", length = 200)
	@Caption(value = "JenisMedia")
	private String namaJenisMedia;

	@Column(name = "Lokasi", length = 200)
	@Caption(value = "Lokasi")
	private String lokasi;

	@JsonManagedReference
	@OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "manajemenPromosi")
	@Caption(value = "jadwalPromosiSet")
	private Set<JadwalPromosi> jadwalPromosiSet = new HashSet<>();

	@Column(name = "NamaFilePks", length = 200)
	@Caption(value = "Nama File Pks")
	private String namaFilePks;

	@Column(name = "PathFile", length = 200)
	@Caption(value = "Path File")
	private String pathFile;

}
