# Path: backend/flindt/integrations/models.py
# class RoleImportRun(FlindtBaseModel):
#     """
#     RoleImport is used to relate import roles to a specific import run.
#     """
# 
#     started = models.DateTimeField(auto_now=True)
#     roles = models.ManyToManyField(Role)
# 
#     def __str__(self):
#         return 'import started at {}'.format(self.started)


import json
import logging
import requests
from flindt.role.models import Role
from flindt.user.models import User
from .models import RoleImportRun




logger = logging.getLogger(__name__)


class GlassFrogImporter(object):
    """
    GlassFrogImporter can be used to import users and roles from GlassFrog.

    To import all users, use `import_users`.
    To import all roles, user `import_circles` with the circle_id, for the
    anchor_circle.
    """

    API_BASE_URL = 'https://glassfrog.holacracy.org/api/v3/'

    def __init__(self, api_key, organization=None):

        self.api_key = api_key
        self.organization = organization


# Path: backend/flindt/integrations/models.py
# class RoleImportRun(FlindtBaseModel):
#     """
#     RoleImport is used to relate import roles to a specific import run.
#     """
# 
#     started = models.DateTimeField(auto_now=True)
#     roles = models.ManyToManyField(Role)
# 
#     def __str__(self):
#         return 'import started at {}'.format(self.started)


# Path: backend/flindt/integrations/importer.py
import json
import logging
import requests
from flindt.role.models import Role
from flindt.user.models import User
from .models import RoleImportRun





logger = logging.getLogger(__name__)


class GlassFrogImporter(object):
    """
    GlassFrogImporter can be used to import users and roles from GlassFrog.

    To import all users, use `import_users`.
    To import all roles, user `import_circles` with the circle_id, for the
    anchor_circle.
    """

    API_BASE_URL = 'https://glassfrog.holacracy.org/api/v3/'

    def __init__(self, api_key, organization=None):

        self.api_key = api_key
        self.organization = organization


        self.import_run = RoleImportRun.objects.create()