/*
 * SPDX-FileCopyrightText: 2004 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#ifndef TANGO_CLIENT_DBHISTORY_H
#define TANGO_CLIENT_DBHISTORY_H

#include <tango/client/DbDatum.h>

#include <string>
#include <vector>

/** @defgroup DBase Database Client classes
 * @ingroup Client
 */

namespace Tango
{

/**********************************************************************
 *                                                                    *
 *  DbHistory - A data object for receiving data history from the     *
 *               Tango database                                       *
 *                                                                    *
 **********************************************************************/

/**
 * Class used to retrieve database object history
 *
 * @headerfile tango.h
 * @ingroup DBase
 */
class DbHistory
{
  public:
    //
    // constructor methods
    //

    DbHistory(std::string, std::string, const std::vector<std::string> &);
    DbHistory(std::string, std::string, std::string, const std::vector<std::string> &);

    //
    // getter methods
    //

    /**
     * Get property name
     *
     * @return The property name
     */
    std::string get_name();
    /**
     * Get attribute name
     *
     * @return The attribute name
     */
    std::string get_attribute_name();
    /**
     * Get change date
     *
     * @return The date
     */
    std::string get_date();
    /**
     * Get value
     *
     * @return The property value
     */
    DbDatum get_value();
    /**
     * Get property deleted flag
     *
     * @return The property deleted flag
     */
    bool is_deleted();

  private:
    std::string propname; // Property name
    std::string attname;  // Attribute name (Not used for device/pipe properties)
    DbDatum value;        // Property value
    std::string date;     // Update date
    bool deleted;         // Deleted flag

    std::string format_mysql_date(std::string);
    void make_db_datum(const std::vector<std::string> &);
};
} // namespace Tango

#endif // TANGO_CLIENT_DBHISTORY_H
