// Copyright (C) 2020 by Joseph Mirabel, LAAS-CNRS.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.


#ifndef HPP_MANIPULATION_CORBA_PATH_PLANNERS_IDL
#define HPP_MANIPULATION_CORBA_PATH_PLANNERS_IDL
#include <hpp/common.idl>

#include <hpp/core_idl/path_planners.idl>
#include <hpp/manipulation_idl/_graph.idl>

module hpp
{
  module core_idl {
    interface PathPlanner;
    interface PathProjector;
  }; // module core

  module manipulation_idl {
    typedef string ValidationReport;
    typedef unsigned long long size_t;
    interface Roadmap : core_idl::Roadmap {
      void constraintGraph (in graph_idl::Graph graph) raises (Error);
    }; // interface Roadmap

    module pathPlanner_idl {
      interface IkSolverInitialization
      {
      }; // interface IkSolverInitialization

      interface EndEffectorTrajectory : core_idl::PathPlanner
      {
        long getNRandomConfig (         ) raises (Error);
        //-> nRandomConfig
        void setNRandomConfig (in long n) raises (Error);
        //-> nRandomConfig

        long getNDiscreteSteps (         ) raises (Error);
        //-> nDiscreteSteps
        void setNDiscreteSteps (in long n) raises (Error);
        //-> nDiscreteSteps

        boolean getCheckFeasibilityOnly (            ) raises (Error);
        //-> checkFeasibilityOnly
        void    setCheckFeasibilityOnly (in boolean n) raises (Error);
        //-> checkFeasibilityOnly

        void setIkSolverInitialization (in IkSolverInitialization solver);
        //-> ikSolverInitialization
      }; // interface EndEffectorTrajectory

      interface TransitionPlanner : core_idl::PathPlanner
      {
        core_idl::PathVector planPath(in floatSeq qInit,
            in floatSeqSeq qGoals, in boolean resetRoadmap) raises(Error);
        core_idl::Path directPath(in floatSeq q1, in floatSeq q2, in boolean
            validate, out boolean success, out string status) raises(Error);
	boolean validateConfiguration(in floatSeq config, in size_t id, out ValidationReport report)
	  raises(Error);
	//* using namespace hpp::core;
	//* Configuration_t q(corbaServer::floatSeqToVector(config));
	//* ValidationReportPtr_t vr;
	//* bool res = getT()->validateConfiguration(q, id, vr);
	//* if (vr) {
	//*   std::ostringstream oss; oss << *vr;
	//*   std::string res = oss.str();
	//*   report = CORBA::string_dup(res.c_str());
	//* } else {
	//*   report = CORBA::string_dup("");
	//* }
	//* return res;
        core_idl::PathVector optimizePath(in core_idl::Path path) raises(Error);
        core_idl::PathVector timeParameterization(in core_idl::PathVector path)
          raises(Error);
        void setReedsAndSheppSteeringMethod(in double turningRadius)
          raises(Error);
        void setEdge(in long id) raises(Error);
        void setPathProjector(in string pathProjectorType,in double tolerance)
          raises(Error);
        //*     std::string _pathProjectorType (pathProjectorType);
        //*     core::ProblemSolverPtr_t ps = server_->problemSolver();
        //*     core::PathProjectorBuilder_t factory(ps->pathProjectors.get
        //*       (_pathProjectorType));
        //*     core::PathProjectorPtr_t pathProjector(factory(getT()->
        //*         innerProblem(), tolerance));
        //*     (getT()->pathProjector (pathProjector));
        void clearPathOptimizers() raises(Error);
        void addPathOptimizer(in string pathOptimizerType) raises(Error);
        //*     std::string _pathOptimizerType (pathOptimizerType);
        //*     core::ProblemSolverPtr_t ps = server_->problemSolver();
        //*     core::PathOptimizerBuilder_t factory(ps->pathOptimizers.get
        //*       (_pathOptimizerType));
        //*     core::PathOptimizerPtr_t pathOptimizer(factory(getT()->
        //*         problem()));
        //*     (getT()->addPathOptimizer (pathOptimizer));
        void setParameter (in string name, in any value) raises (Error);
        //* getT()->innerProblem()->setParameter(name,
        //*     hpp::corbaServer::toParameter(value));

      }; // interface TransitionPlanner

    }; // module pathPlanner_idl
  }; // module manipulation_idl
}; // module hpp

//* #include <hpp/manipulation/path-planner/end-effector-trajectory.hh>
//* #include <hpp/manipulation/path-planner/transition-planner.hh>
//* #include <hpp/core/parameter.hh>
//* #include <hpp/core/problem.hh>
//* #include <hpp/core_idl/paths.hh>
//* #include <hpp/core_idl/path_planners.hh>
//* #include <hpp/core_idl/path_projectors.hh>
//* #include <hpp/manipulation_idl/_graph-fwd.hh>
//* #include <hpp/manipulation/roadmap.hh>
//* #include <hpp/manipulation/problem-solver.hh>

#endif // HPP_MANIPULATION_CORBA_PATH_PLANNERS_IDL
