from app.salary_analytics.services.main import SalaryAnalyticsPipeline
from app.salary_analytics.services.data_loader import DataLoader


class GlobalState:
    def __init__(self):
        self._pipeline = None
        self._data_loader = None
        self.df = None
        self.salary_predictor = None
        self.salary_earner_analyzer = None

    # ---- Pipeline ----
    @property
    def pipeline(self):
        if self._pipeline is None:
            self._pipeline = SalaryAnalyticsPipeline()
        return self._pipeline

    @pipeline.setter
    def pipeline(self, value):
        self._pipeline = value

    # ---- Data Loader ----
    @property
    def data_loader(self):
        if self._data_loader is None:
            self._data_loader = DataLoader()
        return self._data_loader

    @data_loader.setter
    def data_loader(self, value):
        self._data_loader = value

    # ---- DataFrame ----
    @property
    def df(self):
        return self._df

    @df.setter
    def df(self, value):
        self._df = value

    # ---- Salary Predictor ----
    @property
    def salary_predictor(self):
        return self._salary_predictor

    @salary_predictor.setter
    def salary_predictor(self, value):
        self._salary_predictor = value

    # ---- Salary Earner Analyzer ----
    @property
    def salary_earner_analyzer(self):
        return self._salary_earner_analyzer

    @salary_earner_analyzer.setter
    def salary_earner_analyzer(self, value):
        self._salary_earner_analyzer = value


state = GlobalState()

