using HWModules;
using SWModules;

namespace CPF.Surface_States
{
    public class Exit : StateBase
    {
        public Exit(string name)
        {
            stateName.Clear();
            stateName.Append(name);

            ECTimeout = 2 * 60 * 1000;      //2 min
        }

        public override int doStateEntryActions()
        {
            basicStateEntry();
            Program.missionRun = false;

            return (1);
        }

        public override int doStateActions()
        {
            //ensure all data is written to disk
            EngrLogger.sdVol.FlushAll();
            return (1);
        }

        public override int doExitActions(bool timedOut)
        {
            if (timedOut)
            {
                basicStateExit(true);
            }
            else
            {
                basicStateExit(false);
            }
            Program.missionRun = false;

            return (1);
        }

        public override CPFStates checkEvents()
        {
            return (CPFStates.exit);
        }

        public override CPFStates doTimeoutAction()
        {
            return (CPFStates.exit);
        }
    }
}
