# Path: pyehr/utils/services.py
# class ServiceConfig(object):
#     def __init__(self, db_driver, db_host, db_database, db_versioning_database,
#                  db_port, db_user, db_passwd, db_patients_repository,
#                  db_ehr_repository, db_ehr_versioning_repository,
#                  index_url, index_database, index_user, index_passwd,
#                  db_service_host, db_service_port, db_service_server_engine,
#                  query_service_host, query_service_port, query_service_server_engine):
#     def get_db_configuration(self):
#     def get_index_configuration(self):
#     def get_db_service_configuration(self):
#     def get_query_service_configuration(self):
# def get_service_configuration(configuration_file, logger=None):
# def get_rotating_file_logger(logger_label, log_file, log_level='INFO',
#                              max_bytes=100*1024*1024, backup_count=3):
# def check_pid_file(pid_file, logger):
# def create_pid(pid_file):
# def destroy_pid(pid_file):


from lxml import etree
from hashlib import md5
from uuid import uuid4
from copy import copy
from pyehr.utils.services import get_logger
from pybasex import BaseXClient
import pybasex.errors as pbx_errors


class IndexService(object):

    def __init__(self, db, url, user, passwd, logger=None):
        self.url = url
        self.user = user
        self.passwd = passwd
        self.db = db
        self.basex_client = None

# Path: pyehr/utils/services.py
# class ServiceConfig(object):
#     def __init__(self, db_driver, db_host, db_database, db_versioning_database,
#                  db_port, db_user, db_passwd, db_patients_repository,
#                  db_ehr_repository, db_ehr_versioning_repository,
#                  index_url, index_database, index_user, index_passwd,
#                  db_service_host, db_service_port, db_service_server_engine,
#                  query_service_host, query_service_port, query_service_server_engine):
#     def get_db_configuration(self):
#     def get_index_configuration(self):
#     def get_db_service_configuration(self):
#     def get_query_service_configuration(self):
# def get_service_configuration(configuration_file, logger=None):
# def get_rotating_file_logger(logger_label, log_file, log_level='INFO',
#                              max_bytes=100*1024*1024, backup_count=3):
# def check_pid_file(pid_file, logger):
# def create_pid(pid_file):
# def destroy_pid(pid_file):


# Path: pyehr/ehr/services/dbmanager/dbservices/index_service.py
from lxml import etree
from hashlib import md5
from uuid import uuid4
from copy import copy
from pyehr.utils.services import get_logger
from pybasex import BaseXClient
import pybasex.errors as pbx_errors



class IndexService(object):

    def __init__(self, db, url, user, passwd, logger=None):
        self.url = url
        self.user = user
        self.passwd = passwd
        self.db = db
        self.basex_client = None

        self.logger = logger or get_logger('index_service')