from functools import cached_property

from django.apps import AppConfig


class CropSimulationConfig(AppConfig):
    default_auto_field = "django.db.models.BigAutoField"
    name = "crop_simulation"
    verbose_name = "Crop Simulation"

    @cached_property
    def recommendation_optimizer(self):
        from .recommendation_optimizer import SimulationRecommendationOptimizer

        return SimulationRecommendationOptimizer()

    @cached_property
    def current_farm_chart_simulator(self):
        from .growth_simulation import CurrentFarmChartSimulator

        return CurrentFarmChartSimulator()

    @cached_property
    def harvest_prediction_service(self):
        from .harvest_prediction import HarvestPredictionService

        return HarvestPredictionService()

    @cached_property
    def yield_prediction_service(self):
        from .yield_prediction import YieldPredictionService

        return YieldPredictionService()

    @cached_property
    def water_stress_service(self):
        from .water_stress import WaterStressSimulationService

        return WaterStressSimulationService()

    def get_recommendation_optimizer(self):
        return self.recommendation_optimizer

    def get_current_farm_chart_simulator(self):
        return self.current_farm_chart_simulator

    def get_harvest_prediction_service(self):
        return self.harvest_prediction_service

    def get_yield_prediction_service(self):
        return self.yield_prediction_service

    def get_water_stress_service(self):
        return self.water_stress_service
