// Copyright (C) 2019 by Joseph Mirabel, LAAS-CNRS.
//
// This file is part of the hpp-corbaserver.
//
// This software is provided "as is" without warranty of any kind,
// either expressed or implied, including but not limited to the
// implied warranties of fitness for a particular purpose.
//
// See the COPYING file for more information.

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

module hpp
{
  module pinocchio_idl {
  interface Device;
  interface CollisionObject;
  }; // module pinocchio

  module core_idl {
  interface Distance;
  interface SteeringMethod;
  interface ConfigValidation;
  interface PathProjector;
  interface PathValidation;
  interface ConfigurationShooter;
  interface Constraint;
  interface ConstraintSet;

  interface Problem
  {
    HPP_EXPOSE_MEMORY_DEALLOCATION(Error)

    pinocchio_idl::Device robot () raises (Error);

    void setInitConfig (in floatSeq init) raises (Error);
    //* pinocchio::Configuration_t q (corbaServer::floatSeqToConfig(getT()->robot(), init, true));
    //* getT()->initConfig (q);
    floatSeq getInitConfig () raises (Error);
    //-> initConfig
    void addGoalConfig (in floatSeq goal) raises (Error);
    //* pinocchio::Configuration_t q (corbaServer::floatSeqToConfig(getT()->robot(), goal, true));
    //* getT()->addGoalConfig (q);
    void resetGoalConfigs () raises (Error);

    Constraint getConstraints () raises (Error);
    //-> constraints
    void setConstraints (in Constraint constraints) raises (Error);
    //* hpp::core::ConstraintPtr_t c = ::hpp::corbaServer::reference_to_servant_base<hpp::core::Constraint>(server_, constraints)->get();
    //* hpp::core::ConstraintSetPtr_t cs = HPP_DYNAMIC_PTR_CAST(hpp::core::ConstraintSet, c);
    //* if (!cs) throw hpp::Error("Constraint is not of type ConstraintSet");
    //* (getT()->constraints (cs));

    Distance getDistance () raises (Error);
    //-> distance
    void setDistance (in Distance d) raises (Error);
    //-> distance
    SteeringMethod getSteeringMethod () raises (Error);
    //-> steeringMethod
    void setSteeringMethod (in SteeringMethod d) raises (Error);
    //-> steeringMethod
    PathValidation getPathValidation () raises (Error);
    //-> pathValidation
    void setPathValidation (in PathValidation d) raises (Error);
    //-> pathValidation

    PathProjector getPathProjector () raises (Error);
    //-> pathProjector
    void setPathProjector (in PathProjector p) raises (Error);
    //-> pathProjector

    ConfigValidation getConfigValidations () raises (Error);
    //-> configValidations
    void clearConfigValidations () raises (Error);
    void addConfigValidation (in ConfigValidation cfgValidation) raises (Error);

    ConfigurationShooter getConfigurationShooter () raises (Error);
    //-> configurationShooter
    void setConfigurationShooter (in ConfigurationShooter d) raises (Error);
    //-> configurationShooter

    void filterCollisionPairs () raises (Error);

    /// \param margins a symmetric matrix of size (nbJoints+1) x (nbJoints+1).
    ///        Each row/column index corresponds to a joint, 0 being for the
    ///        static world (so obstacle and fixed robot parts).
    void setSecurityMargins (in floatSeqSeq margins) raises (Error);

    void addObstacle (in pinocchio_idl::CollisionObject _object) raises (Error);

    void setParameter (in string name, in any value) raises (Error);
    //* getT()->setParameter(name, hpp::corbaServer::toParameter(value));

    any getParameter (in string name) raises (Error);
    //* return hpp::corbaServer::toCorbaAnyPtr(getT()->getParameter(name));
  }; // interface Problem

  }; // module core
}; // module hpp

//* #include <hpp/core/problem.hh>
//* #include <hpp/pinocchio_idl/robots.hh>
//* #include <hpp/core_idl/distances.hh>
//* #include <hpp/core_idl/steering_methods.hh>
//* #include <hpp/core_idl/path_projectors.hh>
//* #include <hpp/core_idl/path_validations.hh>
//* #include <hpp/core_idl/configuration_shooters.hh>
//* #include <hpp/core/config-validations.hh>

#include <hpp/pinocchio_idl/robots.idl>
#include <hpp/core_idl/distances.idl>
#include <hpp/core_idl/steering_methods.idl>
#include <hpp/core_idl/path_projectors.idl>
#include <hpp/core_idl/path_validations.idl>
#include <hpp/core_idl/configuration_shooters.idl>

#endif // HPP_CORE_PROBLEM_IDL
