from api_library.date_time_actions.date_functions import system_arrow
from databases.no_sql_models.mongo_database import MongoQuery
from databases.no_sql_models.identity import MongoQueryIdentity


query_engine = MongoQueryIdentity(
    company_uuid="5f5f4d2b-0b3f-4b1f-8f8a-3b3b7f3b7f3b",
)
query_engine_mongo = MongoQuery(
    table_name="5f5f4d2b-0b3f-4b1f-8f8a-3b3b7f3b7f3b*Domain",
    database_name="mongo_database",
)

payload = {
    "user_uu_id": "5f5f4d2b-0b3f-4b1f-8f8a-3b3b7f3b7f3b",
    "other_domains_list": ["www.gluglu.com"],
    "main_domain": "www.gluglu.com",
    "modified_at": system_arrow.to_timestamp(system_arrow.now()),
}
query_engine.use_collection("PasswordHistory")
or_insert = query_engine.mongo_engine.find_or_insert(
    payload={
        "user_uu_id": str(payload.get("user_uu_id")),
        "password_history": [],
    },
    field="user_uu_id",
)
print("or_insert", or_insert.data)
quit()
get_all = query_engine_mongo.get_all()
print("get_all", get_all.data)
