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

/*==================================================================================================
File description:
    This file contains the declaration for the Business Object, Val1CfgAgentRevision
    Filename:   Val1CfgAgentRevision.hxx
    Module:     Val1cfgvalidation
    @BMIDE autogenerated
==================================================================================================*/

#ifndef VAL1CFGVALIDATION__VAL1CFGAGENTREVISION__HXX
#define VAL1CFGVALIDATION__VAL1CFGAGENTREVISION__HXX

#include <vector>
#include <metaframework/CreateInput.hxx>
#include <unidefs.h>
#include <string>
#include <map>
#include <common/tc_deprecation_macros.h>
#include <validation/ValidationAgentRevision.hxx>

#include <Val1cfgvalidation/libval1cfgvalidation_exports.h>

namespace val1cfgvalidation
{
    class Val1CfgAgentRevision;
}
namespace val1cfgvalidation
{
    class Val1CfgAgentRevisionImpl;
}
namespace val1cfgvalidation
{
    class Val1CfgAgentRevisionDelegate;
}
namespace val1cfgvalidation
{
    class Val1CfgAgentRevisionDispatch;
}
namespace val1cfgvalidation
{
    class Val1CfgAgentRevisionGenImpl;
}
namespace Teamcenter
{
    class RootObjectImpl;
}

class  VAL1CFGVALIDATION_API  val1cfgvalidation::Val1CfgAgentRevision
     : public  ::Teamcenter::ValidationAgentRevision
{
public:

    /**
     * Get the Interface Name
     * @return - return desc for getInterfaceName
     */
    static const std::string&  getInterfaceName();


    ///
    /// This operation will create new validation results and/or update existing validation results. The getValidationResults operation will be invoked to find all existing validation results for the given checkers and selected business objects. The given resultData will be used to determine whether the Teamcenter::CreateInput structure represents a new validation result or an existing validaiton result. This operation will be called by the OOTB performValidationAndProcessResults operation.
    /// @version Teamcenter 12.1
    /// @param resultData - The vector of structure represents a new validation result or an existing validaiton result.
    /// @param newResults - A list of newly created validation result objects.
    /// @param changedResults - A list of changed validation result objects.
    /// @return - Status. 0 if successful
    ///
    int  val1CreateOrUpdateResults( const std::vector<  ::Teamcenter::CreateInput* > &resultData, std::vector< tag_t > &newResults, std::vector< tag_t > &changedResults );

    ///
    /// This operation will use the configured closure rule to find the objects from the given selected objects for validation checkers to perform validation business logic. These objects collected by the closure rule will be the owning objects of its associated validation results. Valdiation checkers will perform validation functions for these objects.This operation will be called by runValidation operation before the validation tasks will be handed to each specified checkers.
    /// @version Teamcenter 12.1
    /// @param selectedObjectsVec - The vector of selected objects.
    /// @param owningObjsClosureRule - The name of a closure rule that will be used to get owning objects of results from a list of selected objects.
    /// @param owningObjsForValidationVec - The vector of objects for validation.
    /// @return - Status. 0 if successful
    ///
    int  val1GetOwningObjsForValidationFromSelectedObj( const std::vector< tag_t > &selectedObjectsVec, const std::string &owningObjsClosureRule, std::vector< tag_t > &owningObjsForValidationVec );

    ///
    /// This operation will use the configured closure rule to find the target objects from each object for validation checkers to perform validation business logic.
    /// @version Teamcenter 12.1
    /// @param owningObjsForValidationVec - The vector of objects for validation.
    /// @param targetClosureRule - The name of a closure rule that will be used to get validation target objects from a list of owning objects.
    /// @param owningObjectToTargetObjectsVec - The map for owning object to its validation target objects vector.
    /// @return - Status. 0 if successful
    ///
    int  val1GetTargetObjectsFromOwningObjs( const std::vector< tag_t > &owningObjsForValidationVec, const std::string &targetClosureRule, std::map< tag_t,std::vector< tag_t > > &owningObjectToTargetObjectsVec );

    ///
    /// This operation will return the associated validation results after performing the required validation function of the specified checkers on the selected business objects. The associated validation result data that require further processing will be returned in the form of result properties structure vector for validation result objects that will be created and/or updated. This operation will be called by performValidationAndProcessResults operation.
    /// @version Teamcenter 12.1
    /// @param val1ValDataRevVec - The checker revision vector.
    /// @param owningObjectToTargetObjectsVec - The map for owning object to the validation target objects vector.
    /// @param resultData - A vector of structure for result properties name/value pairs.
    /// @return - Status. 0 if successful
    ///
    int  val1PerformValidation( const std::vector< tag_t > &val1ValDataRevVec, const std::map< tag_t,std::vector< tag_t > > &owningObjectToTargetObjectsVec, std::vector<  ::Teamcenter::CreateInput* > &resultData );

    ///
    /// This operation will perform the validation tasks. Each validation agent revision must implement this method to process the validation tasks.
    /// @version Teamcenter 12.1
    /// @param valDataRevisionObjects - A list of ValDataRevision objects that will be used to validate against the validation targets.
    /// @param selectedObjects - A list of selected objects that this validation agent will use to find the actual validation targets for this validation run.
    /// @param owningObjsClosureRule - The name of a closure rule that will be used to get owning objects of results from a list of selected objects.
    /// @param targetClosureRule - The name of a closure rule that will be used to get validation target objects from a list of owning objects.
    /// @param newResults - A list of newly created validation result objects.
    /// @param changedResults - A list of changed validation result objects.
    /// @return - Status. 0 if successful
    ///
    int  val1RunValidation( const std::vector< tag_t > &valDataRevisionObjects, const std::vector< tag_t > &selectedObjects, const std::string &owningObjsClosureRule, const std::string &targetClosureRule, std::vector< tag_t > &newResults, std::vector< tag_t > &changedResults );
protected:
    //  Method to initialize
    virtual void initialize( ::Teamcenter::RootObjectImpl*  impl );

    /**
     * Constructor
     */
    Val1CfgAgentRevision();

    /**
     * Destructor
     */
    virtual ~Val1CfgAgentRevision();

private:
    //  Getter method for the Implementation Object
    Val1CfgAgentRevisionImpl*  getVal1CfgAgentRevisionImpl() const;
    //  Setter method for the Implementation Object
    ::Teamcenter::RootObjectImpl*  setVal1CfgAgentRevisionImpl( ::Teamcenter::RootObjectImpl*  impl );

    //  Method to set the delete impl boolean
    void setDeleteImpl( bool  del );

    // Pointer to the Implementation object
    Val1CfgAgentRevisionImpl*  m_val1cfgagentrevisionImpl;

    //  Flag to indicate if Implementation object needs to be deleted
    bool  m_deleteImpl;

    /**
     * Name of the Business Object
     */
    static std::string  name;

    /**
     * Private default constructor. We do not want this class instantiated without the business object passed in.
     * @param Val1CfgAgentRevision - desc for Val1CfgAgentRevision parameter
     */
    Val1CfgAgentRevision( const Val1CfgAgentRevision& );
    Val1CfgAgentRevision& operator=( const Val1CfgAgentRevision& );

    friend class  Val1CfgAgentRevisionDelegate;
    friend class  Val1CfgAgentRevisionDispatch;
    friend class  Val1CfgAgentRevisionGenImpl;
};

#include <Val1cfgvalidation/libval1cfgvalidation_undef.h>
#endif //   VAL1CFGVALIDATION__VAL1CFGAGENTREVISION__HXX
