package xyz.thastertyn.UserInterface.Content;

import java.util.ArrayList;

import com.googlecode.lanterna.gui2.Direction;
import com.googlecode.lanterna.gui2.GridLayout;
import com.googlecode.lanterna.gui2.Label;
import com.googlecode.lanterna.gui2.LinearLayout;
import com.googlecode.lanterna.gui2.Panel;

import xyz.thastertyn.UserInterface.Listeners.UpdateListener;

public class AbsenceList extends JecnaContent{
	
	private xyz.thastertyn.Scrape.AbsenceList omluvnyList = new xyz.thastertyn.Scrape.AbsenceList();

	public AbsenceList(UpdateListener listener)
	{
		super(listener);
		this.mainPanel = new Panel(new GridLayout(1));
		this.borderLabel = new Label("Absence");
		super.scraper = omluvnyList;
	}

	@Override
	protected void setGUI()
	{
		this.mainPanel.removeAllComponents();
		ArrayList<xyz.thastertyn.Types.AbsenceList> a = omluvnyList.getData();

		Panel content = new Panel(new LinearLayout(Direction.VERTICAL))
			.addTo(mainPanel);

		for(xyz.thastertyn.Types.AbsenceList omluvnyList : a)
		{
			content.addComponent(new Label(omluvnyList.getDate() + " - " + omluvnyList.getDescription()));
		}
	}
}
