# This "activates" the project environment of the package `Qurt`. Normally you would use `Qurt`
# from an environment external to the package.
import Pkg
Pkg.activate(".");

# Now `Qurt` should be visible.
# `import` imports the package, but no other symbols.
import Qurt

# Names of objects that are not imported are printed fully qualified, which is verbose.
# So import more only so names are not printed fully qualified.
import Graphs.SimpleGraphs.SimpleDiGraph
import Qurt.NodeStructs.Node

using BenchmarkTools # This provides tools like Python %timeit

# `using` is similar to `import`. But this invocation imports all of the symbols on the export list of
# `Qurt.Circuits`
using Qurt.Circuits

using Qurt.Interface # many symbols go here as a catch all. They may live elsewhere in the future.

qc = Circuit(2, 2)

using Qurt.IOQDAGs
print_edges(qc)

propertynames(qc)

typeof(qc.graph)  # digraph from `Graphs.jl`

qc.nodes

using Qurt.Builders
import .Qurt.Elements: H, CX, X, Y, RX
(nH, nCX) = @build qc H(1) CX(1,2);

print_edges(qc)

qc[nCX]

qc.nodes.element

Integer(qc.nodes.element[1])

import .Interface.getelement
getelement(qc, 1)  # This is currently a way to access the element

@btime getelement($qc, 1) # Dollar sign is a detail of how @btime works

@btime $qc.nodes.element[1] # This is no more or less efficient

qc = Circuit(2)
@build qc X(1) Y(2)

@build qc begin
    X(1)
    Y(2)
    CX(1,2)
    RX{1.5}(1)
end;

g1 = @gate RX

g2 = @gate RX{1.5}  # circuit element identity and parameters

g3 = @gate RX{1.5}(2)  # Include wires

add_node!(qc, (g1, 1.5), (2,))

add_node!(qc, g2, (2,))

add_node!(qc, g3)

(qc[11:13])

