import sys
from pathlib import Path
from random import random
from typing import List

# Add framework src to path for imports
framework_src_path = Path(__file__).parent.parent.parent.parent / "src"
sys.path.insert(0, str(framework_src_path))

from layer1_core.entities.agent import Agent
from layer1_core.managers.collective import Collective

class Neighborhood(Collective):
    def __init__(self, collective_id: str,
                 segregation_metric: float, #stress
                 eviction_rate: float, #should we actually simulate evictions?
                 housing_security: float, #metric that includes both eviction rate and mortgage denial?
                 vacant_unit_percent: float, #stress, opportunity to use substances?
                 alcohol_tabac_biz_percent: float, #exposure to substances
                 fringe_bank_biz_percent: float, #stress, likelihood of eviction
                 agents: List[Agent] = None):
        super().__init__(collective_id)

        self.segregation_metric = segregation_metric
        self.eviction_rate = eviction_rate
        self.housing_security = housing_security
        self.vacant_unit_percent = vacant_unit_percent
        self.alcohol_tabac_biz_percent = alcohol_tabac_biz_percent
        self.fringe_bank_biz_percent = fringe_bank_biz_percent

        if agents:
            for agent in agents:
                self.register_agent(agent)

class Class(Collective):
    def __init__(self, collective_id: str, agents: List[Agent] = None):
        super().__init__(collective_id)
        if agents:
            for agent in agents:
                self.register_agent(agent)


class Club(Collective):
    def __init__(self, collective_id: str, agents: List[Agent] = None):
        super().__init__(collective_id)
        if agents:
            for agent in agents:
                self.register_agent(agent)


class Grade(Collective):
    def __init__(self, collective_id: str, agents: List[Agent] = None):
        super().__init__(collective_id)
        if agents:
            for agent in agents:
                self.register_agent(agent)


class School(Collective):
    def __init__(self, collective_id: str, agents: List[Agent] = None):
        super().__init__(collective_id)
        if agents:
            for agent in agents:
                self.register_agent(agent)
