package hozza.network.models.twitch.entities;

import java.time.LocalDate;
import java.util.List;

import javax.persistence.*;

@Entity(name="person")
@Table(name="person", indexes = {@Index(columnList = "date_added"),@Index(columnList = "name")})
public class MariaPerson 
{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", updatable = false, nullable = false)
    private Long id;

    @Column(name = "name")
    protected String name;
    
    @Column(name = "date_added")
    protected LocalDate dateAdded;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "person", cascade = CascadeType.ALL)
    private List<MariaWatching> watching;

    protected MariaPerson()
    {

    }

    public List<MariaWatching> getWatching()
    {
        return this.watching;
    }
    
    public MariaPerson(String name, LocalDate date)
    {
        this.name = name;
        this.dateAdded = date;
    }

    public Long getId()
    {
        return this.id;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return this.name;
    }

    public LocalDate getAddedDate()
    {
        return this.dateAdded;
    }

    public void setAddedDate(LocalDate date)
    {
        this.dateAdded = date;
    }
}
