/*
    Copyright 2020 Siemens Digital Industries Software
    ==================================================
    Copyright 2014.
    Siemens Product Lifecycle Management Software Inc.
    All Rights Reserved.
    ==================================================
    Copyright 2020 Siemens Digital Industries Software
*/

/**
    @file

    This file implements Lifecycle Interoperability services resource
    The AbstractResource is an abstract implementation of the Resource interface.

*/

#ifndef LIS0LISFMWRK_ABSTRACTRESOURCE_HXX
#define LIS0LISFMWRK_ABSTRACTRESOURCE_HXX

#include <string>
#include <map>
#include <vector>

#include <Lis0lisfmwrk/toolkit/IExtendedResource.hxx>
#include <Lis0lisfmwrk/libLis0lisfmwrk_exports.h>

/**
    @defgroup LIS0LISFMWRK Lifecycle Interoperability Services Framework AbstractResource class
    @ingroup TC 

    This class helps to create the Lifecycle Interoperability services resource.
    <br/>Resource is created based on its specificiation and properties defined on it. 
    <br/>Lifecycle Interoperability FrameWork out-of-the-box implements Open Services for Lifecycle Collaboration (OSLC) resources.
    <br>The resource is finally used for generating output response based on the media type 
    <br>e.g. Open Services for Lifecycle Collaboration (OSLC) resources like ServiceProviderCatalog, ServiceProvider, Service etc. and the media type supported is application/json
    @{
*/

namespace lis0lisfmwrk
{
    class AbstractResource;
}

class LIS0LISFMWRK_API lis0lisfmwrk::AbstractResource
    : public lis0lisfmwrk::IExtendedResource
{
public:

    /** Constructor */
    AbstractResource();

    /** Destructor */
    virtual ~AbstractResource();
    
    /**
    * @sa IResource::setAbout( const std::string& about )
    */  
    void setAbout( const std::string& about );

    /**
    * @sa IResource::getAbout()
    */
    std::string getAbout();
    
    /**
    * @sa IExtendedResource::setTypes( const std::vector<std::string>& types )
    */
    void setTypes( const std::vector<std::string>& types );

    /**
    * @sa IExtendedResource::getTypes()
    */
    std::vector<std::string> getTypes();

    /**
    * @sa IExtendedResource::getType()
    */
    std::string getType();

    /**
    * @sa IExtendedResource::addType( const std::string& type )
    */
    void addType( const std::string& type );

    /**
    * @sa IExtendedResource::addNamespace( const std::string& value, const std::string& key )
    */
    void addNamespace( const std::string& value, const std::string& key );

    /**
    * @sa IExtendedResource::getNamespacePrefix( const std::string& url, bool &isNull )
    */
    std::string getNamespacePrefix( const std::string& url, bool &isNull );

    /**
    * @sa IExtendedResource::getNamespaceURL( const std::string& prefix, bool &isNull )
    */
    std::string getNamespaceURL( const std::string& prefix, bool &isNull );

    /**
    * @sa IExtendedResource::getNamespaces()
    */
    std::map<std::string, std::string> getNamespaces();
    
    /**
    * @sa IExtendedResource::addProperty( lis0lisfmwrk::Property* value, const std::string& key )
    */
    void addProperty( lis0lisfmwrk::Property* value, const std::string& key );

    /**
    * @sa IExtendedResource::getProperty( const std::string& key )
    */
    lis0lisfmwrk::Property* getProperty( const std::string& key );

    /**
    * @sa IExtendedResource::getProperties()
    */
    std::map<std::string, lis0lisfmwrk::Property*> getProperties();
    
    /**
    * @sa IExtendedResource::addExtendedProperty( lis0lisfmwrk::Property* value, const std::string& key )
    */
    void addExtendedProperty( lis0lisfmwrk::Property* value, const std::string& key );

    /**
    * @sa IExtendedResource::getExtendedProperty( const std::string& key )
    */
    lis0lisfmwrk::Property* getExtendedProperty( const std::string& key );

    /**
    * @sa IExtendedResource::getExtendedProperties()
    */
    std::map<std::string, lis0lisfmwrk::Property*> getExtendedProperties();

    /**
    * @sa IExtendedResource::addXmlLiteralPropertyValue( const std::string& str, const std::string& key )
    */
    void addXmlLiteralPropertyValue( const std::string& str, const std::string& key );

    /**
    * @sa IExtendedResource::getXmlLiteralPropertyValue( const std::string& key )
    */
    std::string getXmlLiteralPropertyValue( const std::string& key );

    /**
    * @sa IExtendedResource::addSimpleStringPropertyValue( const std::string& str, const std::string& key )
    */
    void addSimpleStringPropertyValue( const std::string& str, const std::string& key );

    /**
    * @sa IExtendedResource::getSimpleStringPropertyValue( const std::string& key )
    */
    std::string getSimpleStringPropertyValue( const std::string& key );

    /**
    * @sa IExtendedResource::addResourcePropertyValue( const std::string& str, const std::string& key )
    */
    void addResourcePropertyValue( const std::string& str, const std::string& key );

    /**
    * @sa IExtendedResource::getResourcePropertyValue( const std::string& key )
    */
    std::string getResourcePropertyValue( const std::string& key );

    /**
    * @sa IExtendedResource::getResourcePropertyValues( const std::string& key )
    */
    std::vector<std::string> getResourcePropertyValues( const std::string& key );

    /**
    * Adds local resource property to the property map
    * @param [in] value Local resource property value
    * @param [in] key Resource property name with prefix 
    * @returns void
    */
    void addLocalResourcePropertyValue( lis0lisfmwrk::AbstractResource* value, const std::string& key );

    /**
    * Retrieves the the local resource property from the property map for a given key
    * @param [in] key Resource property name with prefix 
    * @returns Resource Property value
    */
    lis0lisfmwrk::AbstractResource* getLocalResourcePropertyValue( const std::string& key );

    /**
    * Retrieves the local resource properties from the property map for a given key
    * @param [in] key Resource property name with prefix 
    * @returns Resource property value
    */
    std::vector<lis0lisfmwrk::AbstractResource*> getLocalResourcePropertyValues( const std::string& key );

    /**
    * @sa IExtendedResource::addBoolDataPropertyValue( const bool& value, const std::string& key  )
    */
    void addBoolDataPropertyValue( const bool& value, const std::string& key  );

    /**
    * @sa IExtendedResource::getBoolDataPropertyValue( const std::string& key, bool &isNull )
    */
    bool getBoolDataPropertyValue( const std::string& key, bool &isNull );

    /**
    * @sa IExtendedResource::getBoolDataPropertyValues( const std::string& key )
    */
    Teamcenter::BoolVector getBoolDataPropertyValues( const std::string& key );

    /**
    * @sa IExtendedResource::addDoubleDataPropertyValue( const double& value, const std::string& key )
    */
    void addDoubleDataPropertyValue( const double& value, const std::string& key );

    /**
    * @sa IExtendedResource::getDoubleDataPropertyValue( const std::string& key, bool &isNull )
    */
    double getDoubleDataPropertyValue( const std::string& key, bool &isNull );

    /**
    * @sa IExtendedResource::getDoubleDataPropertyValues( const std::string& key )
    */
    Teamcenter::DoubleVector getDoubleDataPropertyValues( const std::string& key );

    /**
    * @sa IExtendedResource::addFloatDataPropertyValue( const double& value, const std::string& key  )
    */
    void addFloatDataPropertyValue( const double& value, const std::string& key  );

    /**
    * @sa IExtendedResource::getFloatDataPropertyValue( const std::string& key, bool &isNull )
    */
    double getFloatDataPropertyValue( const std::string& key, bool &isNull );

    /**
    * @sa IExtendedResource::getFloatDataPropertyValues( const std::string& key )
    */
    Teamcenter::DoubleVector getFloatDataPropertyValues( const std::string& key );

    /**
    * @sa IExtendedResource::
    */
    void addDecimalDataPropertyValue( const double& value, const std::string& key );

    /**
    * @sa IExtendedResource::getDecimalDataPropertyValue( const std::string& key, bool &isNull )
    */
    double getDecimalDataPropertyValue( const std::string& key, bool &isNull );

    /**
    * @sa IExtendedResource::getDecimalDataPropertyValues( const std::string& key )
    */
    Teamcenter::DoubleVector getDecimalDataPropertyValues( const std::string& key );

   /**
    * @sa IExtendedResource::addIntDataPropertyValue( const int& value, const std::string& key  )
    */
    void addIntDataPropertyValue( const int& value, const std::string& key  );

    /**
    * @sa IExtendedResource::getIntDataPropertyValue( const std::string& key, bool &isNull )
    */
    int getIntDataPropertyValue( const std::string& key, bool &isNull );

    /**
    * @sa IExtendedResource::getIntDataPropertyValues( const std::string& key )
    */
    Teamcenter::IntVector getIntDataPropertyValues( const std::string& key );

    /**
    * @sa IExtendedResource::addStringDataPropertyValue( const std::string& value, const std::string& key  )
    * @returns void
    */
    void addStringDataPropertyValue( const std::string& value, const std::string& key  );

    /**
    * @sa IExtendedResource::getStringDataPropertyValue( const std::string& key, bool &isNull )
    */
    std::string getStringDataPropertyValue( const std::string& key, bool &isNull );

    /**
    * @sa IExtendedResource::getStringDataPropertyValues( const std::string& key )
    */
    std::vector<std::string> getStringDataPropertyValues( const std::string& key );

    /**
    * @sa IExtendedResource::addDateTimePropertyValue( const date_t& value, const std::string& key  )
    */
    void addDateTimePropertyValue( const date_t& value, const std::string& key  );

    /**
    * @sa IExtendedResource::getDateTimePropertyValue( const std::string& key, bool &isNull )
    */
    date_t getDateTimePropertyValue( const std::string& key, bool &isNull );

   /**
    * @sa IExtendedResource::getDateTimePropertyValues( const std::string& key )
    */
    Teamcenter::DateVector getDateTimePropertyValues( const std::string& key );

    /**
    * @sa AbstractResource::updateNameSpacePrefix( const std::string& oldPrefix, const std::string& newPrefix, const std::string& prefixValue )
    */
    void updateNameSpacePrefix( const std::string& oldPrefix, const std::string& newPrefix, const std::string& prefixValue );

protected:
    /**
        Defines about URL
    */
    std::string m_about;

    /**
        Defines type URI vector
    */
    std::vector<std::string> m_types;
    
    /**
        Defines the property map, and its key is prefixed name string
    */
    std::map<std::string, lis0lisfmwrk::Property*> m_properties;

    /**
        Defines the extended property map, and its key is prefixed name string
    */
    std::map<std::string, lis0lisfmwrk::Property*> m_extendedProperties;

    /**
        Defines the namespace map, and its key is prefix, and its value is URL string
    */
    std::map<std::string, std::string> m_namespaceMap;
private:

    /** Copy Constructor */
    AbstractResource( const AbstractResource& );

    /** Assignment Operator*/
    AbstractResource& operator=( const AbstractResource& );

};

/** @} */

#include <Lis0lisfmwrk/libLis0lisfmwrk_undef.h>
#endif
