# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
from qiskit_aer import AerSimulator

# qiskit-ibmq-provider has been deprecated.
# Please see the Migration Guides in https://ibm.biz/provider_migration_guide for more detail.
from qiskit_ibm_runtime import QiskitRuntimeService, Sampler, Estimator, Session, Options

# Loading your IBM Quantum account(s)
service = QiskitRuntimeService(channel="ibm_quantum")

# Invoke a primitive inside a session. For more details see https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials.html
# with Session(backend=service.backend("ibmq_qasm_simulator")):
#     result = Sampler().run(circuits).result()

from qiskit import *
IBMQ.save_account(open("token.txt","r").read())  #signing in using my token in my txt file
IBMQ.load_account() #lading account


Aer.backends() #show simulators each is special

provider=IBMQ.get_provider("ibm-q") #show all the actual quantaum computers and simulators that are avaliable
provider.backends()

for backend in provider.backends(): #show properties 
    print(backend.properties())

i=0 #code to see if it is simulator or not and how many pending jobs are there
for backend in provider.backends():
    i+=1
    try:
        qubit_count=len(backend.properties().qubits)
    except:
        qubit_count="simulated"
    if(qubit_count=="simulated"):    
        print(f"{i}-{backend.name()} : there is {backend.status().pending_jobs} waiting jobs in the queue and it is a simulator")
    else:
        print(f"{i}-{backend.name()} : there is {backend.status().pending_jobs} waiting jobs in the queue and it has {qubit_count} qubits")
