package com.gamingmesh.jobs.container;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.bukkit.ChatColor;

import com.gamingmesh.jobs.Jobs;

public class Schedule {

    int From = 0;
    int Until = 235959;

    int nextFrom = 0;
    int nextUntil = 235959;

    boolean nextDay = false;

    BoostMultiplier BM = new BoostMultiplier();

    String Name = null;

    List<String> Days = new ArrayList<String>(Arrays.asList("all"));
    List<Job> JobsList = new ArrayList<Job>();

    List<String> MessageOnStart = new ArrayList<String>();
    List<String> MessageOnStop = new ArrayList<String>();

    List<String> MessageToBroadcast = new ArrayList<String>();

    boolean started = false;
    boolean stoped = true;

    boolean onStop = true;
    boolean OnStart = true;

    long broadcastInfoOn = 0L;
    int broadcastInterval = 0;

    public Schedule() {
    }

    public void setBroadcastInfoOn(long time) {
	this.broadcastInfoOn = time;
    }

    public long getBroadcastInfoOn() {
	return this.broadcastInfoOn;
    }

    public void setBroadcastOnStop(boolean stage) {
	this.onStop = stage;
    }

    public boolean isBroadcastOnStop() {
	return this.onStop;
    }

    public void setBroadcastOnStart(boolean stage) {
	this.OnStart = stage;
    }

    public boolean isBroadcastOnStart() {
	return this.OnStart;
    }

    public void setStarted(boolean stage) {
	this.started = stage;
    }

    public boolean isStarted() {
	return this.started;
    }

    public void setStoped(boolean con) {
	this.stoped = con;
    }

    public boolean isStoped() {
	return this.stoped;
    }

    public void setBoost(CurrencyType type, double amount) {
	this.BM.add(type, amount - 1);
    }

    public double getBoost(CurrencyType type) {
	return this.BM.get(type);
    }

    public BoostMultiplier getBoost() {
	return this.BM;
    }

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

    public String GetName() {
	return this.Name;
    }

    public void setFrom(int From) {
	this.From = From;
    }

    public int GetFrom() {
	return this.From;
    }

    public int GetNextFrom() {
	return this.nextFrom;
    }

    public int GetNextUntil() {
	return this.nextUntil;
    }

    public boolean isNextDay() {
	return this.nextDay;
    }

    public void setUntil(int Until) {
	this.Until = Until;

	if (this.From > this.Until) {
	    this.nextFrom = 0;
	    this.nextUntil = this.Until;
	    this.Until = 236000;
	    this.nextDay = true;
	}
    }

    public int GetUntil() {
	return this.Until;
    }

    public void setJobs(List<String> JobsNameList) {
	for (int z = 0; z < JobsNameList.size(); z++) {

	    if (JobsNameList.get(z).equalsIgnoreCase("all")) {
		JobsList.clear();
		List<Job> jobl = Jobs.getJobs();
		if (jobl != null)
		    JobsList.addAll(Jobs.getJobs());
		return;
	    }

	    Job jb = Jobs.getJob(JobsNameList.get(z));

	    if (jb == null)
		continue;

	    JobsList.add(jb);
	}
    }

    public List<Job> GetJobs() {
	return this.JobsList;
    }

    public void setDays(List<String> Days) {
	for (int z = 0; z < Days.size(); z++) {
	    Days.set(z, Days.get(z).toLowerCase());
	}
	this.Days = Days;
    }

    public List<String> GetDays() {
	return this.Days;
    }

    public void setMessageOnStart(List<String> msg, String From, String Until) {
	List<String> temp = new ArrayList<String>();
	for (String one : msg) {
	    temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
	}
	this.MessageOnStart.addAll(temp);
    }

    public List<String> GetMessageOnStart() {
	return this.MessageOnStart;
    }

    public void setMessageOnStop(List<String> msg, String From, String Until) {
	List<String> temp = new ArrayList<String>();
	for (String one : msg) {
	    temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
	}
	this.MessageOnStop.addAll(temp);
    }

    public List<String> GetMessageOnStop() {
	return this.MessageOnStop;
    }

    public void setMessageToBroadcast(List<String> msg, String From, String Until) {
	List<String> temp = new ArrayList<String>();
	for (String one : msg) {
	    temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
	}
	this.MessageToBroadcast.addAll(temp);
    }

    public List<String> GetMessageToBroadcast() {
	return this.MessageToBroadcast;
    }

    public void setBroadcastInterval(int From) {
	this.broadcastInterval = From;
    }

    public int GetBroadcastInterval() {
	return this.broadcastInterval;
    }

}

@@ -459,22 +459,16 @@
 rayList%3C
-String
 %3E(Arrays
@@ -524,19 +524,16 @@
 rayList%3C
-Job
 %3E();%0D%0A%0D%0A
@@ -576,30 +576,24 @@
 w ArrayList%3C
-String
 %3E();%0D%0A    Li
@@ -625,38 +625,32 @@
 = new ArrayList%3C
-String
 %3E();%0D%0A%0D%0A    List
@@ -689,30 +689,24 @@
 w ArrayList%3C
-String
 %3E();%0D%0A%0D%0A    
@@ -3518,36 +3518,30 @@
 w ArrayList%3C
-String
 %3E();%0D%0A
+
 %09for (String
@@ -3914,38 +3914,32 @@
 = new ArrayList%3C
-String
 %3E();%0D%0A%09for (Stri
@@ -4281,32 +4281,32 @@
 tring Until) %7B%0D%0A
+
 %09List%3CString%3E te
@@ -4324,22 +4324,16 @@
 rayList%3C
-String
 %3E();%0D%0A%09f

Update Schedule.java