package tmcsim.cadsimulator.viewer.model;

import java.util.Observer;
import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate;
import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate;
import tmcsim.common.CADEnums.PARAMICS_STATUS;
import tmcsim.common.CADEnums.SCRIPT_STATUS;

/**
 * CADSimulatorModel represents the state of the Simulation at any point in
 * time. It is comprised of CADSimulatorStatus and CADMediaStatus.
 *
 * @author jdalbey
 * @version $Revision: 1.3 $ $Date: 2006/06/06 20:46:41 $
 */
@SuppressWarnings("serial")
public class CADSimulatorModel
{

    private CADSimulatorStatus simStatus;
    private CADMediaStatus mediaStatus;

    /**
     * Constructor.
     */
    public CADSimulatorModel()
    {
        simStatus = new CADSimulatorStatus();
        mediaStatus = new CADMediaStatus();
    }

    /**
     * Make all of our delegates observers of the given view.
     *
     * @param view Someone that wants to observe us
     */
    public void addObserver(Observer view)
    {
//        super.addObserver(view);
        simStatus.addObserver(view);
        mediaStatus.addObserver(view);
    }

    /**
     * @see SimulationStatusPanel
     */
    public void connectClient()
    {
        simStatus.connectClient();
    }

    /**
     * @see SimulationStatusPanel
     */
    public void disconnectClient()
    {
        simStatus.disconnectClient();
    }

    /**
     * Accessor to current number of clients.
     *
     * @return number of connected clients
     */
    public int getNumClients()
    {
        return simStatus.getNumClients();
    }

    /**
     * @see SimulationStatusPanel
     */
    public void setSimManagerStatus(boolean connection)
    {
        simStatus.setSimManagerStatus(connection);
    }

    /**
     * @see SimulationStatusPanel
     */
    public boolean isSimManagerConnected()
    {
        return simStatus.isSimManagerConnected();
    }

    /**
     * @see SimulationStatusPanel
     */
    public void setTime(long seconds)
    {
        simStatus.setTime(seconds);
    }

    /**
     * @see SimulationStatusPanel
     */
    public void setScriptStatus(SCRIPT_STATUS newStatus)
    {
        simStatus.setScriptStatus(newStatus);
    }

    /**
     * @see SimulationStatusPanel
     */
    public void setParamicsStatus(PARAMICS_STATUS newStatus)
    {
        simStatus.setParamicsStatus(newStatus);
    }

    /**
     * @see SimulationStatusPanel
     */
    public void setParamicsNetworkLoaded(String networkID)
    {
        simStatus.setParamicsNetworkLoaded(networkID);
    }

    /**
     * @see MediaStatusPanel
     */
    public void updateDVDStatus(DVDStatusUpdate update)
    {
        mediaStatus.updateDVDStatus(update);
    }

    /**
     * @see MediaStatusPanel
     */
    public void updateDVDTitle(DVDTitleUpdate update)
    {
        mediaStatus.updateDVDTitle(update);
    }
}
