import os

from qiskit import QuantumCircuit, execute
from qiskit.compiler import transpile
from qiskit.providers.aer import Aer
from qiskit.circuit.random import random_circuit
from rustworkx.visualization import mpl_draw

from qiskit_iqm import IQMProvider

qc_1 = random_circuit(5, 5, measure=True)
qc_2 = random_circuit(5, 5, measure=True)

backend = Aer.get_backend('qasm_simulator')

job = execute([qc_1, qc_2], backend, shots=1000)

result = job.result()

from qiskit_iqm import IQMProvider

provider = IQMProvider(os.environ['IQM_SERVER_URL'])

from qiskit.providers.provider import Provider

isinstance(provider, Provider)

backend = provider.get_backend()

from qiskit.providers import BackendV2

isinstance(backend, BackendV2)

backend.num_qubits

backend.target.qargs

backend.index_to_qubit_name(3)

mpl_draw(backend.coupling_map.graph)

backend.operation_names

qc = random_circuit(5, 5, measure=True, seed=321)
qc.draw(output='mpl')

qc_transpiled = transpile(qc, backend=backend, optimization_level=3)
qc_transpiled.draw(output='mpl')

qc_1 = random_circuit(5, 5, measure=True, seed=123)
qc_2 = random_circuit(5, 5, measure=True, seed=456)

job = execute([qc_1, qc_2], backend, shots=1000)

from qiskit.providers import JobV1

isinstance(job, JobV1)

job.status()

