/*
   HARK Library
   Copyright (C) 2021 Honda Research Institute Japan Inc.
 */

#if !defined(_HARKLIB_TERMINAL_H_INCLUDED_)
#define _HARKLIB_TERMINAL_H_INCLUDED_ 1

#include "hark-lib/hark-lib.h"
#include "hark-lib/object.h"
#include "hark-lib/data.h"

namespace hark
{
    class Terminal: public object {
    public:
        enum Direction {
            input, output, // , parameter,
        };

        enum Attribute {
            required = 0,
            optional = 2,
            single   = 0,
            multiple = 1,
            required_single   = (required + single),
            required_multiple = (required + multiple),
            optional_single   = (optional + single),
            optional_multiple = (optional + multiple),
            _default = required_single,
        };

    private:
        Terminal(Direction direction, const std::string &name, int type, Attribute attribute, data default_value, const std::string &description);
    public:
        ~Terminal();

    public:
        // static Terminal in(const std::string &name, int type, const std::string &description = "");
        static Terminal in(const std::string &name, const std::string &description = "");
        // static Terminal in(const std::string &name, int type, Attribute attribute, data default_value, const std::string &description = "");
        // static Terminal in(const std::string &name, int type, data default_value, const std::string &description = "");
        // static Terminal out(const std::string &name, int type, const std::string &description = "");
        static Terminal out(const std::string &name, const std::string &description = "");

        template<typename T> Terminal &def(const T &default_value)
        {
            return this->def(data(default_value));
        }

        Terminal &def(const char *default_value)
        {
            return this->def(std::string(default_value));
        }

        Terminal &def(const data &default_value);
        Terminal &attribute(Attribute attribute);
        Terminal &description(const std::string &description);

        // void connectNode(NodeDef &node);
        // void disconnectNode(NodeDef &node);

        const std::string&name() const;
        bool has_default_value() const;
        data default_value() const;

    private:
        std::string _name, _description;
        data _default_value;
        // NodeDef *_node;

    };
}

#endif /* #if !defined(_HARKLIB_TERMINAL_H_INCLUDED_) */

/* end of file */
