/*
 *   Copyright 2011 Brian Rosenberger (Brutex Network)
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
package net.brutex.xservices.types;

import java.util.GregorianCalendar;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import net.brutex.xservices.util.BrutexNamespaces;

/**
 * Scheduled job type
 * 
 * @author Brian Rosenberger
 * @since 0.5.0
 *
 */
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES)
@XmlAccessorType(XmlAccessType.FIELD)
public class ScheduledJob {

	@XmlElement(required=true,name="name")
	private String name;
	
	@XmlElement(required=false, name="description")
	private String description;
	
	@XmlElement(required=true, name="datetime")
	private GregorianCalendar date;
	
	@XmlElement(name="script")
	private String script;
	
	/**
	 * Create a new scheduled job.
	 * 
	 * @param name Job name.
	 * @param datetime Scheduled date and time.
	 * @param script The script to execute.
	 */
	public ScheduledJob(String name, GregorianCalendar datetime, String script) {
		this.name = name;
		this.date = datetime;
		this.script = script;
		this.description = null;
	}
	
	/**
	 * Create a new scheduled job.
	 * 
	 * @param name Job name.
	 * @param datetime Scheduled date and time.
	 * @param script The script to execute.
	 * @param description Job description.
	 */ 
	public ScheduledJob(String name, GregorianCalendar datetime, String script, String description) {
		this.name = name;
		this.date = datetime;
		this.script = script;
		this.description = description;
	}
	
	/**
	 * Create a new scheduled job.
	 */
	public ScheduledJob() {
		this.name = null;
		this.date=null;
		this.script=null;
	}
	
	/**
	 * Set name of the job.
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Get name of the job.
	 * @return job name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Set scheduled date.
	 * @param date
	 */
	public void setDate(GregorianCalendar date) {
		this.date = date;
	}

	/**
	 * get scheduled date.
	 * @return date
	 */
	public GregorianCalendar getDate() {
		return date;
	}

	public void setScript(String script) {
		this.script = script;
	}

	public String getScript() {
		return script;
	}
	
	public void setDescription(String desc) {
		this.description = desc;
	}

	public String getDescription() {
		return description;
	}
}
