////////////////////////////////////////////////////////////////////////////////
//                                                                             /
// 2012-2019 (c) Baical                                                        /
//                                                                             /
// This library is free software; you can redistribute it and/or               /
// modify it under the terms of the GNU Lesser General Public                  /
// License as published by the Free Software Foundation; either                /
// version 3.0 of the License, or (at your option) any later version.          /
//                                                                             /
// This library is distributed in the hope that it will be useful,             /
// but WITHOUT ANY WARRANTY; without even the implied warranty of              /
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           /
// Lesser General Public License for more details.                             /
//                                                                             /
// You should have received a copy of the GNU Lesser General Public            /
// License along with this library.                                            /
//                                                                             /
////////////////////////////////////////////////////////////////////////////////
#ifndef BK_API_NODE_H
#define BK_API_NODE_H

namespace Bk
{
    /// <summary> Interface provide access to Baical properties storage tree. </summary>
    class IBNode
    {
    public:
        /// <summary> Get node name </summary>
        /// <param name="o_pName"> pointer to variable contains node name </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetName(tXCHAR **o_pName) = 0;

        /// <summary> Set node name </summary>
        /// <param name="i_pName"> pointer to variable contains node name </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall SetName(const tXCHAR *i_pName) = 0;

        /// <summary> Copy nodes tree recursivly from provided source </summary>
        /// <param name="i_pSource"> source node for copy </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall Copy(Bk::IBNode *i_pSource) = 0;

        /// <summary> Get node attribute name by index, index range is [0 .. N) </summary>
        /// <param name="i_dwIndex"> attribute index </param>
        /// <param name="o_rName"> attribute name, output value</param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetAttr(tUINT32 i_dwIndex, const tXCHAR *&o_rName) = 0;

        /// <summary> Delete node attribute name </summary>
        /// <param name="i_pName"> attribute name</param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall DelAttr(const tXCHAR *i_pName) = 0;

        /// <summary> Get attribute int value </summary>
        /// <param name="i_pName"> attribute name</param>
        /// <param name="o_pValue"> attribute value, output</param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetAttrInt32(const tXCHAR *i_pName, tINT32 *o_pValue) = 0;

        /// <summary> Get attribute text value </summary>
        /// <param name="i_pName"> attribute name</param>
        /// <param name="o_pValue"> attribute value, output</param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetAttrText(const tXCHAR  *i_pName, tXCHAR **o_pValue) = 0;

        /// <summary> Set attribute long value </summary>
        /// <param name="i_pName"> attribute name </param>
        /// <param name="i_lValue"> attribute value </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall SetAttrInt32(const tXCHAR *i_pName, tINT32 i_lValue)= 0;

        /// <summary> Set attribute text value </summary>
        /// <param name="i_pName"> attribute name </param>
        /// <param name="i_pValue"> attribute value </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall SetAttrText(const tXCHAR *i_pName, const tXCHAR *i_pValue) = 0;

        /// <summary> Get next node </summary>
        /// <param name="o_pIXNode"> next node, output </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetNext(Bk::IBNode **o_pIXNode) = 0;

        /// <summary> Get next node using node name </summary>
        /// <param name="i_pName"> node name </param>
        /// <param name="o_pIXNode"> next node, output </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetNext(const tXCHAR *i_pName, Bk::IBNode **o_pIXNode) = 0;

        /// <summary> Get first child </summary>
        /// <param name="o_pIXNode"> child node, output </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetChildFirst(Bk::IBNode **o_pIXNode) = 0;

        /// <summary> Get first child using name </summary>
        /// <param name="i_pName"> node name </param>
        /// <param name="o_pIXNode"> child node, output </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall GetChildFirst(const tXCHAR *i_pName, Bk::IBNode **o_pIXNode) = 0;

        /// <summary> Add empty child node </summary>
        /// <param name="i_pName"> node name </param>
        /// <param name="o_pIXNode"> child node, output </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall AddChildEmpty(const tXCHAR *i_pName, Bk::IBNode **o_pIXNode) = 0;

        /// <summary> Delete child node </summary>
        /// <param name="i_pIXNode"> child node </param>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall DelChild(Bk::IBNode *i_pIXNode) = 0;

        /// <summary> Delete current node </summary>
        /// <returns>Bk::eResult::eOk in case of success</returns>  
        virtual Bk::eResult __stdcall Del() = 0;
                                                                             
        /// <summary> increase node's reference counter </summary>
        /// <returns> new reference counter value </returns>  
        virtual tINT32      __stdcall Add_Ref() = 0;

        /// <summary> decrease node's reference counter </summary>
        /// <returns> new reference counter value </returns>  
        virtual tINT32      __stdcall Release() = 0;
    };

}

#endif //BK_API_NODE_H