from pymongo import MongoClient

from crm.domain import Customer

client = MongoClient("mongodb://localhost:27017")
crm = client.crm
customers = crm.customers

""""
jack = Customer("<NAME>", "ankara, turkey", "<EMAIL>")
result = customers.insert_one(jack.__dict__)
print(f"inserted _id: {result.inserted_id}")
"""

customers_to_insert = [
    Customer("<NAME>", "istanbul, turkey", "<EMAIL>"),
    Customer("<NAME>", "antalya, turkey", "<EMAIL>"),
    Customer("<NAME>", "izmir, turkey", "<EMAIL>")
]
new_customers = []
for cust in customers_to_insert:
    new_customers.append(cust.__dict__)
result = customers.insert_many(new_customers)
print(f"inserted _id's: {result.inserted_ids}")
