/**
 * Copyright © 2012-2024 by Data Virtuality GmbH
 */
package org.teiid.query.processor.proc;

import org.teiid.dqp.internal.process.DVProcedureContext;
import org.teiid.query.sql.symbol.GroupSymbol;

/**
 * @author Dmitry Pogorelov
 * @date 2024.06.10
 */
public class DVProcedureContextImpl implements DVProcedureContext {
	private GroupSymbol virtualGroup;

	public DVProcedureContextImpl(GroupSymbol virtualGroup) {
		this.virtualGroup = virtualGroup;
	}

	@Override
	public String getSchema() {
		if (virtualGroup == null)
			return null;
		return virtualGroup.getSchema();
	}

	@Override
	public String getProcName() {
		if (virtualGroup == null)
			return null;
		return virtualGroup.getShortName();
	}

	@Override
	public String getName() {
		if (virtualGroup == null)
			return "<unnamed procedure>";
		return String.valueOf(virtualGroup);
	}

	@Override
	public String toString() {
		return String.format("DVProcedureContext{%s}", virtualGroup);
	}
}
