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

#include "hark-lib/terminal.h"

namespace hark
{
    Terminal::Terminal(Direction direction, const std::string &name, int type, Attribute attribute, data default_value, const std::string &description):
        _name(name), _default_value(default_value), _description(description)
    {
    }

    Terminal::~Terminal()
    {
    }

    const std::string &
    Terminal::name() const
    {
        return this->_name;
    }

    bool
    Terminal::has_default_value() const
    {
        return !this->_default_value.is_empty();
    }

    data
    Terminal::default_value() const
    {
        return this->_default_value;
    }

    Terminal &
    Terminal::def(const data &default_value)
    {
        this->_default_value = default_value;
        return *this;
    }

    Terminal &
    Terminal::attribute(Attribute attribute)
    {
        // this->_attribute = attribute;
        return *this;
    }

    Terminal &
    Terminal::description(const std::string &description)
    {
        this->_description = description;
        return *this;
    }

    // Terminal
    // Terminal::in(const std::string &name, int type, const std::string &description)
    // {
    //     return Terminal(Direction::input, name, type, Attribute::_default, data(), description);
    // }

    Terminal
    Terminal::in(const std::string &name, const std::string &description)
    {
        return Terminal(Direction::input, name, object::types::any, Attribute::_default, data(), description);
    }

    // Terminal
    // Terminal::in(const std::string &name, int type, Attribute attribute, data default_value, const std::string &description)
    // {
    //     return Terminal(Direction::input, name, type, attribute, default_value, description);
    // }
    //
    // Terminal
    // Terminal::in(const std::string &name, int type, data default_value, const std::string &description)
    // {
    //     return Terminal(Direction::input, name, type, Attribute::_default, default_value, description);
    // }

    // Terminal
    // Terminal::out(const std::string &name, int type, const std::string &description)
    // {
    //     return Terminal(Direction::output, name, type, Attribute::_default, data(), description);
    // }

    Terminal
    Terminal::out(const std::string &name, const std::string &description)
    {
        return Terminal(Direction::output, name, object::types::any, Attribute::_default, data(), description);
    }
    //
    // void
    // Terminal::connectNode(NodeDef &node)
    // {
    //     this->_node = &node;
    // }
}

/* end of file */
