/*
 * Created on Aug 27, 2008 (C) Copyright TANDBERG Television Ltd.
 */

package com.tandbergtv.watchpoint.pmm.web.formbeans.title;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Vijay Silva
 */
public class TitleActivity {

	/* The List of schedules associated with this title */
	private List<TitleSchedule> titleSchedules = new ArrayList<TitleSchedule>();

	/* The Progress History not associated with any Asset List or associated with Planners */
	private TitleSchedule incomingActivity;

	/* The Progress History associated with any Pitch Schedules */
	private List<TitleSchedule> outgoingActivity = new ArrayList<TitleSchedule>();

	/**
	 * @return the pitchActivity
	 */
	public List<TitleSchedule> getOutgoingActivity() {
		return this.outgoingActivity;
	}

	/**
	 * @param activity the outgoing activity to set
	 */
	public void setOutgoingActivity(List<TitleSchedule> activity) {
		this.outgoingActivity = activity;
	}

	/**
	 * @return the incoming activity
	 */
	public TitleSchedule getIncomingActivity() {
		return this.incomingActivity;
	}

	/**
	 * @param activity the incoming activity to set
	 */
	public void setIncomingActivity(TitleSchedule activity) {
		this.incomingActivity = activity;
	}

	/**
	 * @return the titleSchedules
	 */
	public List<TitleSchedule> getTitleSchedules() {
		return titleSchedules;
	}

	/**
	 * @param titleSchedules the titleSchedules to set
	 */
	public void setTitleSchedules(List<TitleSchedule> titleSchedules) {
		this.titleSchedules = titleSchedules;
	}

	/**
	 * Checks if there is at least one Title Schedule present
	 * 
	 * @return true if at least one Title Schedule is present, false otherwise
	 */
	public boolean isTitleSchedulesPresent() {
		return (this.titleSchedules != null && this.titleSchedules.size() > 0);
	}

	/**
	 * Checks if any activity is present for this title
	 * 
	 * @return true if activity is present, false otherwise
	 */
	public boolean isActivityPresent() {
		return (this.isIncomingActivityPresent() || this.isOutgoingActivityPresent());
	}

	/**
	 * Checks if any Planner Activity is present
	 * 
	 * @return true if there is any Planner Activity, false otherwise
	 */
	public boolean isIncomingActivityPresent() {
		return (this.incomingActivity != null && this.incomingActivity.isProgressHistoryPresent());
	}

	/**
	 * Checks if any Distribution Schedule Activity is present
	 * 
	 * @return true if there is any Distribution Schedule Activity, false otherwise
	 */
	public boolean isOutgoingActivityPresent() {
		boolean result = false;
		if (this.outgoingActivity != null) {
			for (TitleSchedule titleSchedule : this.outgoingActivity) {
				result |= titleSchedule.isProgressHistoryPresent();
			}
		}
		return result;
	}
}
