import numpy as np
from qiskit_textbook.tools import random_state
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit,QuantumRegister, ClassicalRegister, transpile, Aer, IBMQ, assemble, execute
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
from qiskit_textbook.tools import random_state
from qiskit.extensions import Initialize
from qiskit.providers.aer.noise import NoiseModel
import qiskit.quantum_info as qi

# Loading your IBM Quantum account(s)
provider = IBMQ.load_account()

qr = QuantumRegister(3, name="q")    # Protocol uses 3 qubits
crz = ClassicalRegister(1, name="crz") # and 2 classical bits
crx = ClassicalRegister(1, name="crx") # in 2 different register
teleportation_circuit = QuantumCircuit(qr, crz, crx)


def psi_00(circuit, q1, q2):
    # FILL YOUR CODE HERE




def Bell_measurement(circuit, q1, q2,crx, crz):
    # FILL YOUR CODE HERE

    
    


def conditional_gates(circuit, q0, crx, crz):
    # FILL YOUR CODE HERE


qr = QuantumRegister(3, name="q")    # Protocol uses 3 qubits
crz, crx = ClassicalRegister(1, name="crz"), ClassicalRegister(1, name="crx") #Classical Registers
teleportation_circuit = QuantumCircuit(qr, crz, crx)


#STEP 1:  Create the Bell state between q0 and q1
psi_00(teleportation_circuit, 0, 1 )

#STEP 2: Bell Measurement
teleportation_circuit.barrier()
Bell_measurement(teleportation_circuit, 1, 2, crx, crz)

#STEP 3: Conditional Gates
teleportation_circuit.barrier()
conditional_gates(teleportation_circuit,0, crx, crz)
teleportation_circuit.draw()
