/*****************************************************************//**
 * \file   Constraint.h
 * \brief  A generic constraint interface to store the specific constraint wheither it is a branching constraint or a cut constraint.
 *
 * \author Matteo Petris
 * \date   February 2023
 *********************************************************************/
#ifndef VISITBRANCHCONSTRAINT_H
#define VISITBRANCHCONSTRAINT_H

#include "Constraint.h"

template<class Type>
class VisitBranchConstraint: public Constraint<Type> {

protected:

	int item;

public:
	/**
	 * Constructor by default.
	 *
	 */
	VisitBranchConstraint() :Constraint<Type>(), item() {
	}


	/**
	 * Constructor with the left hand side, the right hand side and the operator of the constraint.
	 *
	 * \param variables_indexes: vector<int>&
	 * \param rhs: double
	 * \param _operator: const string&
	 */
	VisitBranchConstraint(double rhs, const string& _operator, const int& item, const string& name = "") :
		Constraint<Type>(rhs, _operator, name), item(item) {
	}

	/**
	 * Destructor.
	 *
	 */
	virtual ~VisitBranchConstraint() {
	}

	/**
	 * Get method of items.
	 *
	 * \return items: const pair<int, int>&
	 */
	const int& get_item() const {
		return this->item;
	}

	/**
	 * Get method of items.
	 *
	 * \return items: const pair<int, int>&
	 */
	void set_name(const pair<int, int>& new_items) const {
		this->items = new_items;
	}

	string to_string() const {
		stringstream mystring;
		mystring << this->item << " ";
		mystring << Constraint<Type>::to_string();
		return mystring.str();
	}

	/**
	*  \brief	 Get a string for debug output.
	*  \param    out : ostream
	*  \param    constraint : const ArcBranchConstraint<Type>&
	*  \return   The stream with the message ID added : ostream
	*/
	friend ostream& operator<<(ostream& out, const VisitBranchConstraint<Type>& constraint) {
		out << constraint.to_string();
		return out;
	}
};
#endif //VISITBRANCHCONSTRAINT_H
