# Path: auxi/modelling/business/structure.py
# class Activity(NamedObject):
#     """
#     Represents an activity base class. An activity will typically
#     represent a transaction activity in a business.
# 
#     :param name: The name.
#     :param description: The description.
#     :param start: The datetime the activity should be started.
#     :param end: The datetime the activity should be run until.
#     :param interval: The interval of the activity.
#     """
# 
#     def __init__(self, name,
#                  start=datetime.min, end=datetime.max,
#                  interval=1,
#                  description=None):
#         self._parent_path = ""
#         super(Activity, self).__init__(name, description)
#         self.start_datetime = self._get_date_(start)
#         self.end_datetime = self._get_date_(end)
#         self.interval = interval
#         self.start_period_ix = -1
#         self.end_period_ix = -1
#         self.period_count = -1
# 
#     def _get_date_(self, date):
#         if type(date) is str:
#             return datetime.strptime(date, '%Y-%m-%d')
#         else:
#             return date
# 
#     def set_parent_path(self, value):
#         """
#         Set the parent path and the path from the new parent path.
# 
#         :param value: The path to the object's parent
#         """
# 
#         self._parent_path = value
#         self.path = value + r'/' + self.name
# 
#     @property
#     def name(self):
#         return self._name
# 
#     @name.setter
#     def name(self, value):
#         self._name = value
#         self.path = self._parent_path + r'/' + self.name
# 
#     def _meet_execution_criteria(self, ix_period):
#         if self.interval != 0 and (ix_period+1) % self.interval != 0:
#             return False
#         return ix_period >= self.start_period_ix and \
#             ix_period + self.interval  <= self.end_period_ix
# 
#     def prepare_to_run(self, clock, period_count):
#         """
#         Prepare the activity for execution.
# 
#         :param clock: The clock containing the execution start time and
#           execution period information.
#         :param period_count: The total amount of periods this activity will be
#           requested to be run for.
#         """
# 
#         if self.start_period_ix == -1 and self.start_datetime != datetime.min:
#             # Set the Start period index
#             for i in range(0, period_count):
#                 if clock.get_datetime_at_period_ix(i) > self.start_datetime:
#                     self.start_period_ix = i
#                     break
#         if self.start_period_ix == -1:
#             self.start_period_ix = 0
#         if self.period_count == -1 and self.end_datetime != datetime.max:
#             # Set the Start date
#             for i in range(0, period_count):
#                 if clock.get_datetime_at_period_ix(i) > self.end_datetime:
#                     self.period_count = i - self.start_period_ix
#                     break
#         if self.period_count != -1:
#             self.end_period_ix = self.start_period_ix + self.period_count
#         else:
#             self.end_period_ix = self.start_period_ix + period_count
# 
#     def get_referenced_accounts(self):
#         """
#         Retrieve the general ledger accounts referenced in this instance.
# 
#         :returns: The referenced accounts.
#         """
# 
#         return []


from datetime import datetime
from dateutil.relativedelta import relativedelta
from auxi.modelling.business.structure import Activity
    from auxi.modelling.business.basic_test import BasicActivityUnitTester
    from auxi.modelling.business.basic_test import BasicLoanActivityUnitTester
    import unittest
                 bank_account,
                 loan_account,
                 interest_account,
                 purchase_amount=0,
                 writeoff_amount=0,
                 depreciation_rate=0.0,
                 start=datetime.min,
                 lifetime=60,
                 interval=1,
                 description=None):
        """
        """
        super(BasicEquipment, self).__init__(
            name,
            description=description,
            start=start,
            end=start + relativedelta(months=duration),
            interval=interval)
        self.bank_account = bank_account
        self.loan_account = loan_account
        self.interest_account = interest_account
        self._amount = amount
        self.duration = duration
        self.interest_rate = interest_rate

        self._months_executed = 0
        self._amount_left = amount
'''



# Path: auxi/modelling/business/structure.py
# class Activity(NamedObject):
#     """
#     Represents an activity base class. An activity will typically
#     represent a transaction activity in a business.
# 
#     :param name: The name.
#     :param description: The description.
#     :param start: The datetime the activity should be started.
#     :param end: The datetime the activity should be run until.
#     :param interval: The interval of the activity.
#     """
# 
#     def __init__(self, name,
#                  start=datetime.min, end=datetime.max,
#                  interval=1,
#                  description=None):
#         self._parent_path = ""
#         super(Activity, self).__init__(name, description)
#         self.start_datetime = self._get_date_(start)
#         self.end_datetime = self._get_date_(end)
#         self.interval = interval
#         self.start_period_ix = -1
#         self.end_period_ix = -1
#         self.period_count = -1
# 
#     def _get_date_(self, date):
#         if type(date) is str:
#             return datetime.strptime(date, '%Y-%m-%d')
#         else:
#             return date
# 
#     def set_parent_path(self, value):
#         """
#         Set the parent path and the path from the new parent path.
# 
#         :param value: The path to the object's parent
#         """
# 
#         self._parent_path = value
#         self.path = value + r'/' + self.name
# 
#     @property
#     def name(self):
#         return self._name
# 
#     @name.setter
#     def name(self, value):
#         self._name = value
#         self.path = self._parent_path + r'/' + self.name
# 
#     def _meet_execution_criteria(self, ix_period):
#         if self.interval != 0 and (ix_period+1) % self.interval != 0:
#             return False
#         return ix_period >= self.start_period_ix and \
#             ix_period + self.interval  <= self.end_period_ix
# 
#     def prepare_to_run(self, clock, period_count):
#         """
#         Prepare the activity for execution.
# 
#         :param clock: The clock containing the execution start time and
#           execution period information.
#         :param period_count: The total amount of periods this activity will be
#           requested to be run for.
#         """
# 
#         if self.start_period_ix == -1 and self.start_datetime != datetime.min:
#             # Set the Start period index
#             for i in range(0, period_count):
#                 if clock.get_datetime_at_period_ix(i) > self.start_datetime:
#                     self.start_period_ix = i
#                     break
#         if self.start_period_ix == -1:
#             self.start_period_ix = 0
#         if self.period_count == -1 and self.end_datetime != datetime.max:
#             # Set the Start date
#             for i in range(0, period_count):
#                 if clock.get_datetime_at_period_ix(i) > self.end_datetime:
#                     self.period_count = i - self.start_period_ix
#                     break
#         if self.period_count != -1:
#             self.end_period_ix = self.start_period_ix + self.period_count
#         else:
#             self.end_period_ix = self.start_period_ix + period_count
# 
#     def get_referenced_accounts(self):
#         """
#         Retrieve the general ledger accounts referenced in this instance.
# 
#         :returns: The referenced accounts.
#         """
# 
#         return []


# Path: auxi/modelling/business/basic.py
from datetime import datetime
from dateutil.relativedelta import relativedelta
from auxi.modelling.business.structure import Activity
    from auxi.modelling.business.basic_test import BasicActivityUnitTester
    from auxi.modelling.business.basic_test import BasicLoanActivityUnitTester
    import unittest

                 bank_account,
                 loan_account,
                 interest_account,
                 purchase_amount=0,
                 writeoff_amount=0,
                 depreciation_rate=0.0,
                 start=datetime.min,
                 lifetime=60,
                 interval=1,
                 description=None):
        """
        """
        super(BasicEquipment, self).__init__(
            name,
            description=description,
            start=start,
            end=start + relativedelta(months=duration),
            interval=interval)
        self.bank_account = bank_account
        self.loan_account = loan_account
        self.interest_account = interest_account
        self._amount = amount
        self.duration = duration
        self.interest_rate = interest_rate

        self._months_executed = 0
        self._amount_left = amount
'''



class BasicLoanActivity(Activity):