package com.itsol.quantrivanphong.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "eproject")
public class Eproject {

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

    @Column(name = "position", nullable = false)
    private String position;

    @Column(name = "join_date")
    private String joinDate;

    @Column(name = "out_date")
    private String outDate;

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

    //    @JsonIgnore
    @ManyToOne(fetch = FetchType.EAGER)
    private Project project;

    @JsonIgnore
    @OneToMany(mappedBy = "eproject", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    private List<TimeSheet> timeSheetList  = new ArrayList<>();
}
