/*******************************************************************************
 * Copyright (c) 2015-2016 ONERA.
 * Ce logiciel est la propriété de l’ONERA (the French Aerospace Lab).
 * Tous droits réservés.
 *
 * Ce programme et les éléments qui l'accompagnent sont mis à disposition
 * aux conditions définies par le contrat de licence logiciel CeCILL-C soumise
 * au droit français et respectant les principes de diffusion des logiciels libres.
 * Vous pouvez utiliser, modifier et/ou redistribuer ce programme
 * sous les conditions de la licence CeCILL-C (http://www.cecill.info).

 * This software is property of ONERA (the French Aerospace Lab).
 * All rights reserved.
 *
 * This program and the accompanying materials are made available under
 * the terms of the CeCILL-C license under French law and
 * abiding by the rules of distribution of free software.
 * You can  use, modify and/ or redistribute the software under the terms of
 * the CeCILL-C license (http://www.cecill.info).
 *
 * Contributeurs/contributors:
 *     Guillaume Infantes (ONERA - Centre de Toulouse) - initial API and implementation
 *
 *******************************************************************************/

#ifndef ALTARICA_JSON_HH
#define ALTARICA_JSON_HH

#include <map>
#include <string>
#include <vector>
#include "AltaricaInitInfo.hh"

namespace epoch {
    namespace altarica {

	class AltaricaModel;
	class Value;
	class Event;
	class EventLaw;
	class AltaricaState;
	class MetaEvent;
	class Event;
	

	class AltaricaJson : public AltaricaInitInfo {
	private:
	    std::vector<std::vector<Event *>*> testCase;
	    std::vector<std::vector<Event *>*> activeEvents;
	    std::vector<std::vector<Event *>*> inactiveEvents;
	    std::map<Variable*, Value*> goalValues;
	    void parseJsonFile(std::string jsonFile);
	    bool hasInit_;
	    bool hasGoal_;
	    bool hasEvents_;
    bool hasActive_;
    bool hasInactive_;
    
	    bool verbose;
	    
	    std::vector<MetaEvent*> * matchMEV(std::vector<Event*> *mev, std::vector<MetaEvent*>* allmev);
    std::vector<MetaEvent*> * selectSmaller(std::vector<MetaEvent*> *set);
    


	public:
	    AltaricaJson(std::string jsonFile, AltaricaModel *am);	  
	    virtual bool hasInit() {return hasInit_;}
	    virtual bool hasGoal() {return hasGoal_;}
	    virtual bool hasEvents() {return hasEvents_;}
	    virtual std::string toString() const;
	    bool runTestCase(AltaricaState *curState, bool printFlow =false, bool printNULL =false, bool printDomain = false);

	};

    }
}

#endif
