import Apikeys
import requests

"""
I want to construct this with the goal of a TUI/GUI app that lets you string together multiple calls.
For instance, someone should be able to input that they want to add everyone from a CSV using their email
and then add their properties. Assuming everything is in a CSV the data flow for this would be:
1. Import CSV with email value into app
2. Bulk Invite using email
3. Get each person with a filter for email
4. Bulk Post custom learner prop with value

So how can I reuse something over and over? If I need to list people, all I need is the Api key & Endpoint.
Should the app instantiate a Globals class with the key, headers, and baseurl, and then you call the specific
function?
"""

class ApiGlobals:
    apikey = ""
    headers = {"accept": "application/json", "X-Api-Key": apikey }
    baseurl = "https://api.northpass.com/v2/"

    def __init__(self, apikey):
        self.apikey = apikey

class ListPeople:
    endpoint = "people/"
    print(endpoint)

    def call_endpoint():
        response = requests.get(listpeople.endpoint, headers=client.headers)

    # def __init__(self, endpoint, include, page, limit, q):
    #     self.endpoint = endpoint
    #     self.include = include
    #     self.page = page
    #     self.limit = limit
    #     self.q = q
    #
    #     self.list_dict = {"endpoint": self.endpoint, "include": self.include, "page":self.page,
    #                  "limit":self.limit, "q":self.q}

    def listpeople():
        for item, val in listpeople.list_dict.items():
            if val is not None:
                print(val)
            else:
                print("nothing exists")
        response = requests.get(listpeople.endpoint, headers=client.headers)

# class PostPeopleCustomProps:
#     endpoint = "properties/people/bulk"
#     payload = { "data": [
#         {
#             "attributes": { "properties": { newKey: NewValue } },
#             "id": uuid,
#             "type": "person_properties"
#         }
#     ] }

class PostBulkInvite:
    endpoint = "bulk/people"

setup = ApiGlobals(Apikeys.SANDATA)
p = ListPeople()
