#pragma once

#include "QuantumCircuitElementNode.h"

class RectangleNode;
class EquationNode;
class QuantumGate;
class LatexMathExpression;

class QuantumGateNode : public QuantumCircuitElementNode
{
public:
	QuantumGateNode(const Transform& t = {});

	virtual ~QuantumGateNode();

	Point getConnectionLocation(AbstractQuantumWire* wire) const override;

	void setContent(QuantumGate* gate);

	void update(SceneInfo* sceneInfo);
private:
	void createOrUpdateGeometry(SceneInfo* sceneInfo);

	QuantumGate* mContent{ nullptr };
	bool mContentDirty{ true };

	std::unique_ptr<RectangleNode> mBody;

	double mBodyWidth = 30;
	double mBodyHeight = 24;
	std::unique_ptr<LatexMathExpression> mLabelExpression;
	std::unique_ptr<EquationNode> mLabel;
};