package hozza.network.models.twitch.entities;

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

import javax.persistence.*;

@Entity(name="streamer")
@Table(name="streamer", indexes = {@Index(columnList = "channel"),@Index(columnList = "name")})
public class MariaStreamer
{
    @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;

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

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "country", nullable = false)
    private MariaCountry country;

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

    protected MariaStreamer()
    {

    }

    public MariaStreamer(String channel, String name, LocalDate date, MariaCountry country)
    {
        this.name = name;
        this.dateAdded = date;
        this.channel = channel;
        this.country = country;
    }

    public MariaCountry getCountry()
    {
        return this.country;
    }

    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;
    }

    public List<MariaWatching> getBeingWatched()
    {
        return this.BeingWatched;
    }

    public void getCountry(MariaCountry c)
    {
        this.country = c;
    }

    public String getChannel()
    {
        return this.channel;
    }

    public void setChannel(String s)
    {
        this.channel = s;
    }
}
