package com.itsol.quantrivanphong.model;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.itsol.quantrivanphong.audit.DateAudit;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

@NoArgsConstructor
@AllArgsConstructor
@Entity
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(value = {"createdAt", "updatedAt"},
        allowGetters = true)
@Table(name = "leave_form")
@Data
@Builder
public class LeaveForm extends DateAudit {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false, unique = true)
    private int id;

    @Column(name = "title")
    private String title;

    @Column(name = "content")
    private String content;

    @Column(name = "status", nullable = false)
    private boolean status;

    //    @JsonIgnore
    @ManyToOne(fetch = FetchType.EAGER)
    private Employee employee;

    //    @JsonIgnore
    @ManyToOne(fetch = FetchType.EAGER)
    private LeaveType leaveType;
}
